https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25516 Bug ID: 25516 Summary: Item/pickup_locations wantarray removed, so dies on Perl >=5.24 where "autoderef" feature absent Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Hold requests Assignee: stalkernoid@gmail.com Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, slavashishkin@gmail.com After last updates, until around May 11, "wantarray" in sub pickup_locations was removed, but it might be hidden on Perls before v5.24, because there was autoderef experimental feature (https://www.effectiveperlprogramming.com/2010/11/use-array-references-with-t...), the feature removed in Perl v5.24, and Ubuntu 16.04 has Perl v5.22, Ubuntu 18.04 has Perl v5.26. Since newer Perls it will definitely produce the error because now it uses $arr_reference as a single item and maps over it once, and the process dies with "no method" or whatever. There might be other places in the code that uses this v5.14-5.24 feature for example to keys, map, grep $arr_reference. The place I bumped in: 1. On the clean devenv after “reset_all” go to /cgi-bin/koha/admin/smart-rules.pl and press “Save” button on “Default checkout, hold and return policy” to save the empty record (GUI allows that), – this is needed to have in the table “circulation_rule” key “hold_fulfillment_policy” appeared with empty string value so code will reach the right place. Another option to have the same “hold_fulfillment_policy” empty string is to reset DB and go through onboarding.pl (and how I found). So, after onboarding, you don’t ever need to save the empty record, it will be filled automatically. To check: SELECT rule_name, rule_value FROM circulation_rules WHERE rule_name='hold_fulfillment_policy' it produces: "hold_fulfillment_policy", "" 2. open item record /cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1 - it produced the bug: Software error: Can't call method "unblessed" on unblessed reference at ../reserve/request.pl line 581. The code from request.pl line 581: ``` $item->{pickup_locations} = join( ', ', map { $_->unblessed->{branchname} } Koha::Items->find($itemnumber) ->pickup_locations( { patron => $patron } ) ); $item->{pickup_locations_code} = join( ',', map { $_->unblessed->{branchcode} } Koha::Items->find($itemnumber) ->pickup_locations( { patron => $patron } ) ); ``` and that's because sub pickup_locations (recent changes, where wantarray removed, so might be more places) now does this: return \@pickup_locations; Yet it might work on Perl <5.24. Peter: please search through code where we might have similar issues, and meanwhile, provide a patch for the current one above. -- You are receiving this mail because: You are watching all bug changes.