[Koha-bugs] [Bug 27745] Use of uninitialized value in hash element error at C4/Search.pm

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 22 11:56:46 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27745

--- Comment #1 from Peter Vashchuk <stalkernoid at 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.


More information about the Koha-bugs mailing list