Bug 31244: Fix 500 if logout and not logged in

Can't use an undefined value as a HASH reference at /kohadevbox/koha/C4/Auth.pm line 985
        C4::Auth::checkauth('CGI=HASH(0x5603b7dc4300)', 0, 'HASH(0x5603b2633238)', 'intranet', undef, 'intranet-main.tt') called at /kohadevbox/koha/C4/Auth.pm line 186
        C4::Auth::get_template_and_user('HASH(0x5603b7b83d08)') called at /kohadevbox/koha/mainpage.pl line 40

Test plan:
Open a private window
Hit /cgi-bin/koha/mainpage.pl?logout.x=1

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1ae5454b01)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2022-07-26 14:55:02 +02:00 committed by Lucas Gass
parent 1ce81043ca
commit e0b8c2fcc8

View file

@ -982,7 +982,7 @@ sub checkauth {
# voluntary logout the user
# check wether the user was using their shibboleth session or a local one
my $shibSuccess = C4::Context->userenv->{'shibboleth'};
my $shibSuccess = C4::Context->userenv ? C4::Context->userenv->{'shibboleth'} : undef;
if ( $session ) {
$session->delete();
$session->flush;