Bugzilla – Attachment 117138 Details for
Bug 27745
Use of uninitialized value in hash element error at C4/Search.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27745: prevent warning for uninitialized value as a hash key
Bug-27745-prevent-warning-for-uninitialized-value-.patch (text/plain), 1.88 KB, created by
Peter Vashchuk
on 2021-02-22 10:56:46 UTC
(
hide
)
Description:
Bug 27745: prevent warning for uninitialized value as a hash key
Filename:
MIME Type:
Creator:
Peter Vashchuk
Created:
2021-02-22 10:56:46 UTC
Size:
1.88 KB
patch
obsolete
>From 035b59cf98408a78beb63f4ebc83498e97f56eec Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Mon, 22 Feb 2021 12:56:09 +0200 >Subject: [PATCH] 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. >--- > C4/Search.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index f5f91db4a6..9e12deb1a5 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1875,7 +1875,7 @@ sub searchResults { > $onloan_items->{$key}->{due_date} = $item->{onloan}; > $onloan_items->{$key}->{count}++ if $item->{$hbranch}; > $onloan_items->{$key}->{branchname} = $item->{branchname}; >- $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; >+ $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} // '' }; > $onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; > $onloan_items->{$key}->{description} = $item->{description}; > $onloan_items->{$key}->{imageurl} = >-- >2.28.0
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 27745
:
117138
|
117554
|
117614
|
117783