Bugzilla – Attachment 106302 Details for
Bug 25440
Remove undef and CGI warnings and fix template variables list in circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25440: Fix for "uninitialized value in hash" warning in smart-rules.pl
Bug-25440-Fix-for-uninitialized-value-in-hash-warn.patch (text/plain), 1.60 KB, created by
Martin Renvoize (ashimema)
on 2020-06-25 14:41:30 UTC
(
hide
)
Description:
Bug 25440: Fix for "uninitialized value in hash" warning in smart-rules.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-25 14:41:30 UTC
Size:
1.60 KB
patch
obsolete
>From e7cc67a69d1a5399d3152fc8f3f75224ec49b227 Mon Sep 17 00:00:00 2001 >From: Andrew Nugged <nugged@gmail.com> >Date: Sun, 10 May 2020 18:18:35 +0300 >Subject: [PATCH] Bug 25440: Fix for "uninitialized value in hash" warning in > smart-rules.pl > >This warning emitted: > >Use of uninitialized value in hash element >at /admin/smart-rules.pl line 569. > >that happened because we have NULLs in SQL results for 'categorycode' >and 'itemtype' which later used as 'any' kind of category/item in the >template, so for the template it passed this way: > > $rules->{ $r->{categorycode} }->{ $r->{itemtype} }->... > >but undef will stringify as "" to become a hash key ("Hashes are >unordered collections of scalar values indexed by their associated >string key" https://perldoc.perl.org/perldata.html), > >that's why "undef warning". To prevent warning here is the simple fix: > > $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->... > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/smart-rules.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 84761674dd..64c86aa3fc 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -570,7 +570,7 @@ my $definedbranch = $all_rules->count ? 1 : 0; > my $rules = {}; > while ( my $r = $all_rules->next ) { > $r = $r->unblessed; >- $rules->{ $r->{categorycode} }->{ $r->{itemtype} }->{ $r->{rule_name} } = $r->{rule_value}; >+ $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value}; > } > > $template->param(show_branch_cat_rule_form => 1); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25440
:
104635
|
104636
|
104637
|
104638
|
104639
|
104640
|
105059
|
105063
|
105985
|
106300
|
106301
| 106302 |
106303
|
106304
|
106305
|
106388