From 9611f3fbc651038d2039952ce05f6e065011ddb8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Jun 2021 16:57:45 +0200 Subject: [PATCH] Bug 17427: Use JSON serialization Signed-off-by: Kyle M Hall --- C4/Auth.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index c8188d12e51..9191df32e86 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1842,15 +1842,16 @@ will be created. sub _get_session_params { my $storage_method = C4::Context->preference('SessionStorage'); + my $serializer = q{serialize:JSON}; if ( $storage_method eq 'mysql' ) { my $dbh = C4::Context->dbh; # Note that the doc is wrong, type is required, if not provided it default to File - return { dbh => $dbh, type => 'serialize:yamlxs;driver:mysql;id:MD5' }; + return { dbh => $dbh, type => "driver:mysql;$serializer;id:MD5" }; } elsif ( $storage_method eq 'Pg' ) { die "The system preference SessionStorage is set to 'Pg' but this is not supported yet!"; } elsif ( $storage_method eq 'memcached' and my $memcached = Koha::Caches->get_instance->memcached_cache ) { return { - type => 'serialize:yamlxs;driver:Memcached;id:SHA1', + type => "driver:Memcached;id:SHA1;$serializer", cache => $memcached, }; } elsif ( $storage_method ne 'tmp' ) { @@ -1863,14 +1864,14 @@ sub _get_session_params { } 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 { type => 'serialize:yamlxs;driver:File;id:MD5', directory => "$dir/cgisess_$instance" }; + return { type => "driver:File;$serializer;id:MD5", directory => "$dir/cgisess_$instance" }; } } sub get_session { my $sessionID = shift; my $params = _get_session_params(); - my $session = Data::Session->new( %$params ) || die $Data::Session::errstr; + my $session = Data::Session->new( %$params, id => $sessionID ) || die $Data::Session::errstr; return $session; } -- 2.25.1