[Koha-bugs] [Bug 27970] New: Koha::Template::Plugin::Branches->pickup_location is failing due to unexpected behavior of Koha::Libraries->new->empty

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Mar 17 09:33:07 CET 2021


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

            Bug ID: 27970
           Summary: Koha::Template::Plugin::Branches->pickup_location is
                    failing due to unexpected behavior of
                    Koha::Libraries->new->empty
 Change sponsored?: ---
           Product: Koha
           Version: 20.05
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Circulation
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andreas.jonsson at kreablo.se
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

This test-script:

#!/usr/bin/perl -w 
#
use strict;

use Koha::Libraries;
use Data::Dumper;

my @empty = map {$_->unblessed} Koha::Libraries->new->empty;

print Dumper(\@empty);


yields this output:

$VAR1 = [
          []
        ];

In other words, we get an array with a reference to an empty array.  This is
unexpected in two different ways:

* The array should contain hash references (whenever it contains anything).
* The array should be empty.

The problem is that this will cause Template::Plugin::Branches->pickup_location
to crash in some circumstances.

A workaround is to add something like this to the loop:

            next if is_arrayref($l);

I'm guessing the actual error is in DBIx.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list