Bugzilla – Attachment 105040 Details for
Bug 25516
Item/pickup_locations wantarray removed, so dies on Perl >=5.24 where "autoderef" feature absent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25516: Fix for "Can't call method unblessed on unblessed reference"
Bug-25516-Fix-for-Cant-call-method-unblessed-on-un.patch (text/plain), 2.58 KB, created by
Victor Grousset/tuxayo
on 2020-05-18 18:21:45 UTC
(
hide
)
Description:
Bug 25516: Fix for "Can't call method unblessed on unblessed reference"
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-05-18 18:21:45 UTC
Size:
2.58 KB
patch
obsolete
>From f1c47b547278a66b511423c26f62b757efd6b004 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Mon, 18 May 2020 14:45:56 +0300 >Subject: [PATCH] Bug 25516: Fix for "Can't call method unblessed on unblessed > reference" >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Software error: > Can't call method "unblessed" on unblessed reference at ../reserve/request.pl line 581. >was caused by recent commit with `wantarray` removal in sub pickup_locations in âItem.pmâ >and visible on fresher Perls (where experimental feature "autoderef" removed https://www.effectiveperlprogramming.com/2010/11/use-array-references-with-the-array-operators/ ) > >To test: > 1) Get a clean dev environment after "reset_all" > 2) Add an empty record for âDefault checkout, hold and return policyâ on /cgi-bin/koha/admin/smart-rules.pl. > 3) Open item record, like /cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1 > 4) Observe the error (Can't call method "unblessed" on unblessed reference at ../reserve/request.pl line 581.) > 5) Apply patch. > 6) Repeat steps 2 and 3. > 7) Observe that the error is gone. > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > reserve/request.pl | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/reserve/request.pl b/reserve/request.pl >index 61f853d085..b84f257f02 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -577,14 +577,13 @@ foreach my $biblionumber (@biblionumbers) { > $item->{pickup_locations} = 'Any library'; > $item->{pickup_locations_code} = 'all'; > } else { >+ my $arr_locations = Koha::Items->find($itemnumber) >+ ->pickup_locations( { patron => $patron } ); >+ > $item->{pickup_locations} = join( ', ', >- map { $_->unblessed->{branchname} } >- Koha::Items->find($itemnumber) >- ->pickup_locations( { patron => $patron } ) ); >+ map { $_->unblessed->{branchname} } @$arr_locations); > $item->{pickup_locations_code} = join( ',', >- map { $_->unblessed->{branchcode} } >- Koha::Items->find($itemnumber) >- ->pickup_locations( { patron => $patron } ) ); >+ map { $_->unblessed->{branchcode} } @$arr_locations); > } > > push( @available_itemtypes, $item->{itype} ); >-- >2.26.2
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 25516
:
105012
|
105040
|
105058