Bug 30532: (bug 29957 follow-up) Fix '$cookie->value'
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 21 Apr 2022 13:05:24 +0000 (15:05 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 21 Apr 2022 23:41:36 +0000 (13:41 -1000)
We got
 Can't call method "value" on unblessed reference at /kohadevbox/koha/opac/opac-messaging.pl line 86

$cookie can be an arrayref, we should retrieve the session id using
CGI->cookie('CGISESSID')

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
opac/opac-messaging.pl
opac/opac-sendbasket.pl
reports/guided_reports.pl

index 84867da..01faeb3 100755 (executable)
@@ -83,7 +83,7 @@ if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
     $template->param( sms_providers => $providers, sms_provider_id => $patron->sms_provider_id );
 }
 
-my $new_session_id = $cookie->value;
+my $new_session_id = $query->cookie('CGISESSID');
 $template->param(
     csrf_token => Koha::Token->new->generate_csrf({
             session_id => $new_session_id,
index d77a5b5..75ddd3d 100755 (executable)
@@ -180,7 +180,7 @@ END_OF_BODY
     output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
 }
 else {
-    my $new_session_id = $cookie->value;
+    my $new_session_id = $query->cookie('CGISESSID');
     $template->param(
         bib_list       => $bib_list,
         url            => "/cgi-bin/koha/opac-sendbasket.pl",
index a05314f..c497dcc 100755 (executable)
@@ -77,7 +77,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
         flagsrequired   => { reports => $flagsrequired },
     }
 );
-my $session = $cookie ? get_session($cookie->value) : undef;
+my $session_id = $input->cookie('CGISESSID');
+my $session = $session_id ? get_session($session_id) : undef;
 
 my $filter;
 if ( $input->param("filter_set") or $input->param('clear_filters') ) {