From 97b1bd1daec11b5720dc3de3ace65fcc9dd0f65b Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 20 Apr 2022 05:27:32 +0000 Subject: [PATCH] Bug 29744: Remove unnecessary condition in C4::Auth::safe_exit Signed-off-by: Marcel de Rooy [EDIT] Adding David's comments from Bugzilla to safe_exit here. Signed-off-by: Tomas Cohen Arazi --- C4/Auth.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index fae37b97dc..d194d41de9 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -56,9 +56,11 @@ use Koha::CookieManager; use vars qw($ldap $cas $caslogout); our (@ISA, @EXPORT_OK); +#NOTE: The utility of keeping the safe_exit function is that it can be easily re-defined in unit tests and plugins sub safe_exit { - if (C4::Context::psgi_env) { die 'psgi:exit' } - else { exit } + # It's fine for us to "exit" because CGI::Compile (used in Plack::App::WrapCGI) redefines "exit" for us automatically. + # Since we only seem to use C4::Auth::safe_exit in a CGI context, we don't actually need PSGI detection at all here. + exit; } -- 2.39.5