From a858e8a8b895640f2be80ea7b0f9a7b97afb4729 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 27 Dec 2007 16:47:28 -0600 Subject: [PATCH] session management: use YAML::Syck for serialization When using mysql and a sufficiently recent version of DBD::mysql that actually respects the mysql_enable_utf8 option, setting the current branch to a name that includes a diacritic causes the session to fail and forces the user to the login screen upon clicking another link. This turned out to be due to the default (Data::Dumper) serialization used by CGI::Session, which truncated the session object at the diacritic. By enabling that module's YAML serialization option, the problem was resolved. This patch introduces a dependency on the YAML::Syck module. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Auth.pm | 6 +++--- Makefile.PL | 1 + about.pl | 1 + install_misc/debian.packages | 1 + installer/install.pl | 3 +++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index c1fb298c84..1e4210d11a 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1083,14 +1083,14 @@ sub get_session { my $dbh = C4::Context->dbh; my $session; if ($storage_method eq 'mysql'){ - $session = new CGI::Session("driver:MySQL", $sessionID, {Handle=>$dbh}); + $session = new CGI::Session("driver:MySQL;serializer:yaml", $sessionID, {Handle=>$dbh}); } elsif ($storage_method eq 'Pg') { - $session = new CGI::Session("driver:PostgreSQL", $sessionID, {Handle=>$dbh}); + $session = new CGI::Session("driver:PostgreSQL;serializer:yaml", $sessionID, {Handle=>$dbh}); } else { # catch all defaults to tmp should work on all systems - $session = new CGI::Session("driver:File", $sessionID, {Directory=>'/tmp'}); + $session = new CGI::Session("driver:File;serializer:yaml", $sessionID, {Directory=>'/tmp'}); } return $session; } diff --git a/Makefile.PL b/Makefile.PL index d9eb375d00..6eae570328 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -520,6 +520,7 @@ WriteMakefile( 'XML::SAX::ParserFactory' => 1.01, 'XML::Simple' => 2.14, 'XML::RSS' => 1.31, +'YAML::Syck' => 1.00, }, # File tree mapping diff --git a/about.pl b/about.pl index 1833bea57f..e07ba30438 100755 --- a/about.pl +++ b/about.pl @@ -112,6 +112,7 @@ XML::LibXSLT XML::SAX::ParserFactory XML::Simple XML::RSS +YAML::Syck /; my @components = (); diff --git a/install_misc/debian.packages b/install_misc/debian.packages index 90685c921b..4c9eefba18 100644 --- a/install_misc/debian.packages +++ b/install_misc/debian.packages @@ -59,6 +59,7 @@ libxml2-dev install libxml2-utils install libxslt1-dev install libxslt1.1 install +libyaml-syck-perl install libyaz install libyaz-dev install yaz install diff --git a/installer/install.pl b/installer/install.pl index f13f1e1612..32a552dda3 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -66,6 +66,9 @@ if ( $step && $step == 1 ) { unless ( eval { require ZOOM } ) { push @missing, { name => "ZOOM" }; } + unless ( eval { require YAML::Syck } ) { + push @missing, { name => "YAML::Syck" }; + } unless ( eval { require LWP::Simple } ) { push @missing, { name => "LWP::Simple" }; } -- 2.39.5