Bug 8905: Error when accessing invalid authority origin/new/bug_8905
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 11 Oct 2012 19:05:07 +0000 (15:05 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 25 Oct 2012 13:06:37 +0000 (15:06 +0200)
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 !

C4/AuthoritiesMarc.pm

index dde1c05..114e593 100644 (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);
 }