Bugzilla – Attachment 120836 Details for
Bug 28317
Remove CGI::Session::Serialize::yaml dependency by using the default serializer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28317: Use the default CGI::Session serializer
Bug-28317-Use-the-default-CGISession-serializer.patch (text/plain), 3.65 KB, created by
Jonathan Druart
on 2021-05-11 12:54:24 UTC
(
hide
)
Description:
Bug 28317: Use the default CGI::Session serializer
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-05-11 12:54:24 UTC
Size:
3.65 KB
patch
obsolete
>From fd32c1b2afc0d60b35f7b78065616a5a425a6833 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 11 May 2021 14:27:21 +0200 >Subject: [PATCH] Bug 28317: Use the default CGI::Session serializer >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >We remove YAML::Syck on bug 22824 and YAML on 27673, to use YAML::XS. >However we need one of them for CGI::Session::Serialize::yaml >It's preferable to change the serializer and use the default one instead >of writing one based on YAML::XS (or patch the existing ::yaml that does >not seem maintained). > >There was an encoding bug reported on the default serializer (see commit >a858e8a8b895640f2) but we fail to recreate it. > >Test plan: >Create 3 libraries with branchcode=branchname: "CPL", "ÃÃÃ~ÃãÃ" and "âï¸ â¤ï¸ â" >Use the 3 options of SessionStorage and switch from one logged in >library to another. >Confirm that everything is working correctly (ie. no ending issue in the >library name at the top-right corner) >--- > C4/Auth.pm | 8 ++++---- > C4/Context.pm | 10 +++++++--- > 2 files changed, 11 insertions(+), 7 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 1d795615331..f281def2ce0 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1850,21 +1850,21 @@ sub _get_session_params { > my $storage_method = C4::Context->preference('SessionStorage'); > if ( $storage_method eq 'mysql' ) { > my $dbh = C4::Context->dbh; >- return { dsn => "driver:MySQL;serializer:yaml;id:md5", dsn_args => { Handle => $dbh } }; >+ return { dsn => "driver:MySQL;id:md5", dsn_args => { Handle => $dbh } }; > } > elsif ( $storage_method eq 'Pg' ) { > my $dbh = C4::Context->dbh; >- return { dsn => "driver:PostgreSQL;serializer:yaml;id:md5", dsn_args => { Handle => $dbh } }; >+ return { dsn => "driver:PostgreSQL;id:md5", dsn_args => { Handle => $dbh } }; > } > elsif ( $storage_method eq 'memcached' && Koha::Caches->get_instance->memcached_cache ) { > my $memcached = Koha::Caches->get_instance()->memcached_cache; >- return { dsn => "driver:memcached;serializer:yaml;id:md5", dsn_args => { Memcached => $memcached } }; >+ return { dsn => "driver:memcached;id:md5", dsn_args => { Memcached => $memcached } }; > } > else { > # catch all defaults to tmp should work on all systems > my $dir = C4::Context::temporary_directory; > my $instance = C4::Context->config( 'database' ); #actually for packages not exactly the instance name, but generally safer to leave it as it is >- return { dsn => "driver:File;serializer:yaml;id:md5", dsn_args => { Directory => "$dir/cgisess_$instance" } }; >+ return { dsn => "driver:File;id:md5", dsn_args => { Directory => "$dir/cgisess_$instance" } }; > } > } > >diff --git a/C4/Context.pm b/C4/Context.pm >index c0e518a8bc8..57a0de74945 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -745,9 +745,13 @@ set_userenv is called in Auth.pm > #' > sub set_userenv { > shift @_; >- my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name, $register_id, $register_name)= >- map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here >- @_; >+ my ( >+ $usernum, $userid, $usercnum, $userfirstname, >+ $usersurname, $userbranch, $branchname, $userflags, >+ $emailaddress, $shibboleth, $desk_id, $desk_name, >+ $register_id, $register_name >+ ) = @_; >+ > my $var=$context->{"activeuser"} || ''; > my $cell = { > "number" => $usernum, >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28317
:
120835
|
120836
|
120837
|
120839
|
120840