Bug 27970 - Koha::Template::Plugin::Branches->pickup_location is failing due to unexpected behavior of Koha::Libraries->new->empty
Summary: Koha::Template::Plugin::Branches->pickup_location is failing due to unexpecte...
Status: RESOLVED DUPLICATE of bug 29807
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: 20.05
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-17 08:33 UTC by Andreas Jonsson
Modified: 2022-01-06 11:51 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jonsson 2021-03-17 08:33:07 UTC
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.
Comment 1 Tomás Cohen Arazi 2022-01-06 11:49:27 UTC

*** This bug has been marked as a duplicate of bug 29807 ***
Comment 2 Tomás Cohen Arazi 2022-01-06 11:51:18 UTC
Thanks for the report, Andreas, I'm sorry I didn't notice it earlier. Working on a fix based on your findings, on bug 29807.