Bug 31244 - Logout when not logged in raise a 500
Summary: Logout when not logged in raise a 500
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Victor Grousset/tuxayo
URL:
Keywords:
Depends on:
Blocks: 30588
  Show dependency treegraph
 
Reported: 2022-07-27 07:07 UTC by Jonathan Druart
Modified: 2023-12-28 20:44 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.05, 21.11.16


Attachments
Bug 31244: Fix 500 if logout and not logged in (1.25 KB, patch)
2022-07-27 07:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 31244: Fix 500 if logout and not logged in (1.31 KB, patch)
2022-07-27 07:24 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 31244: Fix 500 if logout and not logged in (1.37 KB, patch)
2022-07-27 22:54 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 31244: [21.11.x] Fix 500 if logout and not logged in (1.56 KB, patch)
2023-01-26 17:45 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31244: [21.11.x] Fix 500 if logout and not logged in (2.04 KB, patch)
2023-01-27 08:35 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-07-27 07:07:00 UTC
If /cgi-bin/koha/mainpage.pl?logout.x=1 is hit when the user is not logged in, a 500 is displayed.

    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
Comment 1 Jonathan Druart 2022-07-27 07:07:57 UTC
Created attachment 138147 [details] [review]
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
Comment 2 ByWater Sandboxes 2022-07-27 07:24:02 UTC
Created attachment 138148 [details] [review]
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>
Comment 3 Sally 2022-07-27 07:24:41 UTC
Works as described - signing off.  Thanks for the patch!
Comment 4 Victor Grousset/tuxayo 2022-07-27 22:54:59 UTC
Created attachment 138188 [details] [review]
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>
Comment 5 Victor Grousset/tuxayo 2022-07-27 22:55:19 UTC
Works, qa script happy, code looks good, passing QA :)
Comment 6 Tomás Cohen Arazi 2022-07-28 13:15:17 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 7 Lucas Gass 2022-09-02 20:29:40 UTC
Backported to 22.05.x for 22.05.05
Comment 8 Arthur Suzuki 2022-09-14 11:49:13 UTC
Won't backport to 21.11.x.
Issue not reproduced + the patch breaks perl compilation.
'''
Starting Z39.50/SRU daemon for kohadev:Global symbol "$auth_state" requires explicit package name (did you forget to declare "my $auth_state"?) at /kohadevbox/koha/C4/Auth.pm line 982.
BEGIN not safe after errors--compilation aborted at /kohadevbox/koha/C4/Auth.pm line 2001.
'''
Comment 9 Martin Renvoize 2023-01-26 17:35:58 UTC
This also affects 21.11.x

I'm not sure how you were getting the error you suggest you have Arthur.. we don't introduce auth_state here at all.
Comment 10 Martin Renvoize 2023-01-26 17:36:59 UTC
It's easy to replicate in the shibboleth environment.. it's very hard without.
Comment 11 Martin Renvoize 2023-01-26 17:42:50 UTC
OK.. I see.. the conflict comes out really wierd..

I'll drop a 21.11.x specific patch here in a few minutes.
Comment 12 Martin Renvoize 2023-01-26 17:45:17 UTC
Created attachment 145696 [details] [review]
Bug 31244: [21.11.x] 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>
Rebased for 21.11.x
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2023-01-27 08:35:08 UTC
Created attachment 145717 [details] [review]
Bug 31244: [21.11.x] 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>
Rebased for 21.11.x
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Arthur Suzuki 2023-01-27 10:12:36 UTC
applied to 21.11.x for 21.11.16
Comment 15 wainuiwitikapark 2023-03-15 01:37:41 UTC
Not backported to 21.05.x