Browse Source

Bug 23271: Prevent crash if called without parameters

Can't use an undefined value as a HASH reference at /kohadevbox/koha/Koha/Objects/Limit/Library.pm line 87.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Jonathan Druart 2 years ago
parent
commit
6a941e5b86
  1. 1
      Koha/Objects/Limit/Library.pm
  2. 6
      t/db_dependent/Koha/Patron/Attribute/Types.t

1
Koha/Objects/Limit/Library.pm

@ -71,6 +71,7 @@ sub search_with_library_limits {
]
};
$params //= {};
$attributes //= {};
if ( exists $attributes->{join} ) {
if ( ref $attributes->{join} eq 'ARRAY' ) {

6
t/db_dependent/Koha/Patron/Attribute/Types.t

@ -388,7 +388,7 @@ subtest 'replace_library_limits() tests' => sub {
subtest 'search_with_library_limits() tests' => sub {
plan tests => 5;
plan tests => 6;
$schema->storage->txn_begin;
@ -427,6 +427,10 @@ subtest 'search_with_library_limits() tests' => sub {
is( $results->count, 3, '3 attribute types are available with no library passed' );
$results = Koha::Patron::Attribute::Types->search_with_library_limits();
is( $results->count, 3, 'No crash if no params passed' );
$schema->storage->txn_rollback;
};

Loading…
Cancel
Save