Bug 22483: Explicitly ban 'undef' as a valid $flagsrequired
[koha.git] / C4 / Auth.pm
index 8932066..c49076e 100644 (file)
@@ -2072,6 +2072,10 @@ sub _dispatch {
 
 sub haspermission {
     my ( $userid, $flagsrequired ) = @_;
+
+    Koha::Exceptions::WrongParameter->throw('$flagsrequired should not be undef')
+      unless defined($flagsrequired);
+
     my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?");
     $sth->execute($userid);
     my $row = $sth->fetchrow();