From 92f90c226e044feaedbdd3dde128509b5c827208 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 16 Sep 2022 07:20:36 +0000 Subject: [PATCH] Bug 29744: (QA follow-up) Call psgi_env in OO style Content-Type: text/plain; charset=utf-8 Result of git grep -l -E "::psgi_env" | xargs sed -i -e's/::psgi_env/->psgi_env/g' Also resolving this warn from Auth.t: Use of uninitialized value $ENV{"SCRIPT_NAME"} in pattern match (m//) at /usr/share/koha/Koha/AuthUtils.pm line 211. Note that the following warn is resolved on report 30588 (underway). Use of uninitialized value $return in numeric gt (>) at /usr/share/koha/C4/Auth.pm line 1154. Test plan: Run t/db_dependent/Auth.t Hit some opac, intranet pages. API call. Signed-off-by: Marcel de Rooy --- C4/Auth_with_shibboleth.pm | 6 +++--- Koha/AuthUtils.pm | 2 +- about.pl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm index 1eb14edc67..5a46737c59 100644 --- a/C4/Auth_with_shibboleth.pm +++ b/C4/Auth_with_shibboleth.pm @@ -81,7 +81,7 @@ sub get_login_shib { my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is}; - if ( C4::Context::psgi_env ) { + if ( C4::Context->psgi_env ) { return $ENV{"HTTP_".uc($matchAttribute)} || ''; } else { return $ENV{$matchAttribute} || ''; @@ -126,7 +126,7 @@ sub _autocreate { my %borrower = ( $config->{matchpoint} => $match ); while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) { - if ( C4::Context::psgi_env ) { + if ( C4::Context->psgi_env ) { $borrower{$key} = ( $entry->{'is'} && $ENV{"HTTP_" . uc($entry->{'is'}) } ) || $entry->{'content'} || ''; } else { $borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; @@ -144,7 +144,7 @@ sub _sync { my %borrower; $borrower{'borrowernumber'} = $borrowernumber; while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) { - if ( C4::Context::psgi_env ) { + if ( C4::Context->psgi_env ) { $borrower{$key} = ( $entry->{'is'} && $ENV{"HTTP_" . uc($entry->{'is'}) } ) || $entry->{'content'} || ''; } else { $borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; diff --git a/Koha/AuthUtils.pm b/Koha/AuthUtils.pm index 1a1ccba830..6a8c009bb1 100644 --- a/Koha/AuthUtils.pm +++ b/Koha/AuthUtils.pm @@ -208,7 +208,7 @@ outside this context. =cut sub get_script_name { - if ( ( C4::Context::psgi_env ) && $ENV{SCRIPT_NAME} =~ m,^/(intranet|opac)(.*), ) { + if ( ( C4::Context->psgi_env ) && $ENV{SCRIPT_NAME} && $ENV{SCRIPT_NAME} =~ m,^/(intranet|opac)(.*), ) { return '/cgi-bin/koha' . $2; } else { return $ENV{SCRIPT_NAME}; diff --git a/about.pl b/about.pl index c9b229b55a..30e943b67e 100755 --- a/about.pl +++ b/about.pl @@ -125,7 +125,7 @@ if ($^O ne 'VMS') { my $zebraVersion = `zebraidx -V`; # Check running PSGI env -if ( C4::Context::psgi_env ) { +if ( C4::Context->psgi_env ) { $template->param( is_psgi => 1, psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" : -- 2.30.2