Bug 8905: Error when accessing invalid authority

The GetAuthority shim does not check that authority retrieval was
successful, and therefore can call ->record on an undefined value.

This can be reproduced by trying to load an invalid authority record
using bulkmarcimport. There may be other ways to trigger it, but I'm
not sure what they are.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
another way to trigger this error is just forging your URL with a wrong
authid !
This commit is contained in:
Jared Camins-Esakov 2012-10-11 15:05:07 -04:00 committed by Paul Poulain
parent 215c8f4e3b
commit cc9b23d3d7

View file

@ -856,6 +856,7 @@ Returns MARC::Record of the authority passed in parameter.
sub GetAuthority {
my ($authid)=@_;
my $authority = Koha::Authority->get_from_authid($authid);
return unless $authority;
return ($authority->record);
}