[Bug 27745] New: Use of uninitialized value in hash element error at /usr/share/koha/lib/C4/Search.pm
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Bug ID: 27745 Summary: Use of uninitialized value in hash element error at /usr/share/koha/lib/C4/Search.pm Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: trivial Priority: P5 - low Component: Searching Assignee: stalkernoid@gmail.com Reporter: stalkernoid@gmail.com QA Contact: testopia@bugs.koha-community.org CC: nugged@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Use of uninitialized value |Use of uninitialized value |in hash element error at |in hash element error at |/usr/share/koha/lib/C4/Sear |C4/Search.pm |ch.pm | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 --- Comment #1 from Peter Vashchuk <stalkernoid@gmail.com> --- Created attachment 117138 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117138&action=edit Bug 27745: prevent warning for uninitialized value as a hash key When you edit and save items in current code with an empty "c - Shelving location" field, it gets stored into the database as "NULL", which is allowed in the database, and the field is not "required", so this seems expected. But when the search page book's card is rendered, it gets value by location key ($shelflocations->{ $item->{location} }) which gives undef warning. Solved by screening undef value with the empty string. To reproduce: 1) Edit the book or create new one with an empty shelving location. 2) Use the search feature to have that book in the searched list. 3) Check plack-intranet-error.log to find "Use of uninitialized value in hash element" error. 4) Apply the patch. 5) Repeat the search and check the logs again to ensure that error didn't appear again. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |didier.gautheron@biblibre.c | |om --- Comment #2 from Didier Gautheron <didier.gautheron@biblibre.com> --- Hi, Missing in test plan: 1.a) loan the item. Moreover elsewhere there's stuff like: $other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; Shouldn't it use the same here too ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 --- Comment #3 from Peter Vashchuk <stalkernoid@gmail.com> --- Hey, I don't think you need to loan the item specifically to get this error, I tested it again and I got the error even when item wasn't leaned. Unless I misunderstood what you meant, in that case please correct me. I agree, thanks for pointing that out. It makes more sense to change it to:
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location};
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117138|0 |1 is obsolete| | --- Comment #4 from Peter Vashchuk <stalkernoid@gmail.com> --- Created attachment 117554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117554&action=edit Bug 27745: prevent warning for uninitialized value as a hash key When you edit and save items with an empty "c - Shelving location" field, it gets stored into the database as "NULL", which is allowed in the database, and the field is not "required", so this seems expected. But when the search page is rendered, it gets value by location key ($shelflocations->{ $item->{location} }) which gives undef warning. Solved by checking if $item->{location} is perl true. To reproduce: 1) Edit the book or create new one with an empty shelving location. 2) Use the search feature to have that book in the searched list. 3) Check plack-intranet-error.log to find "Use of uninitialized value in hash element" error. 4) Apply the patch. 5) Repeat the search and check the logs again to ensure that error didn't appear again. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117554|0 |1 is obsolete| | --- Comment #5 from Didier Gautheron <didier.gautheron@biblibre.com> --- Created attachment 117614 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117614&action=edit Bug 27745: prevent warning for uninitialized value as a hash key When you edit and save items with an empty "c - Shelving location" field, it gets stored into the database as "NULL", which is allowed in the database, and the field is not "required", so this seems expected. But when the search page is rendered, it gets value by location key ($shelflocations->{ $item->{location} }) which gives undef warning. Solved by checking if $item->{location} is perl true. To reproduce: 1) Edit the book or create new one with an empty shelving location. 2) Use the search feature to have that book in the searched list. 3) Check plack-intranet-error.log to find "Use of uninitialized value in hash element" error. 4) Apply the patch. 5) Repeat the search and check the logs again to ensure that error didn't appear again. Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117614|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 117783 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117783&action=edit Bug 27745: prevent warning for uninitialized value as a hash key When you edit and save items with an empty "c - Shelving location" field, it gets stored into the database as "NULL", which is allowed in the database, and the field is not "required", so this seems expected. But when the search page is rendered, it gets value by location key ($shelflocations->{ $item->{location} }) which gives undef warning. Solved by checking if $item->{location} is perl true. To reproduce: 1) Edit the book or create new one with an empty shelving location. 2) Use the search feature to have that book in the searched list. 3) Check plack-intranet-error.log to find "Use of uninitialized value in hash element" error. 4) Apply the patch. 5) Repeat the search and check the logs again to ensure that error didn't appear again. Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|21.05.00 |21.05.00,20.11.04 released in| | CC| |fridolin.somers@biblibre.co | |m --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 20.11.x for 20.11.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com Version(s)|21.05.00,20.11.04 |21.05.00,20.11.04,20.05.10 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Pushed to 20.05.x for 20.05.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net Resolution|--- |FIXED Status|Pushed to oldstable |RESOLVED --- Comment #10 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|25790 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org