Bug 25491: Fix for "Use of uninitialized value" in InstallAuth.pm

This warning was thrown:
    Use of uninitialized value $info{"invalid_username_or_password"}
    in numeric eq (==) at /home/vagrant/kohaclone/C4/InstallAuth.pm
    line 387.

There is the case when hash key can be undefined in numeric comparison.

Fixed by adding additional precheck for
$info{"invalid_username_or_password"} being Perl's "true".

To test:
    1) Go to the first page of the web-installer where it asks to login.
    2) Observe the warning in the log file.
    3) Apply patch.
    4) Repeat step 1.
    7) Check that previous warning suppressed.

Mentored-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Slava Shishkin 2020-05-13 20:20:27 +03:00 committed by Jonathan Druart
parent 6886cf93ec
commit d81438e143
1 changed files with 1 additions and 1 deletions

View File

@ -384,7 +384,7 @@ sub checkauth {
$template->param( login => 1 );
$template->param( loginprompt => 1 ) unless $info{'nopermission'};
if ($info{'invalid_username_or_password'} == 1) {
if ($info{'invalid_username_or_password'} && $info{'invalid_username_or_password'} == 1) {
$template->param( 'invalid_username_or_password' => $info{'invalid_username_or_password'});
}