session management: use YAML::Syck for serialization
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 27 Dec 2007 22:47:28 +0000 (16:47 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 27 Dec 2007 23:24:02 +0000 (17:24 -0600)
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 <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>

C4/Auth.pm
Makefile.PL
about.pl
install_misc/debian.packages
installer/install.pl

index c1fb298..1e4210d 100755 (executable)
@@ -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;
 }
index d9eb375..6eae570 100644 (file)
@@ -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
index 1833bea..e07ba30 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -112,6 +112,7 @@ XML::LibXSLT
 XML::SAX::ParserFactory
 XML::Simple
 XML::RSS
+YAML::Syck
       /;
 
 my @components = ();
index 90685c9..4c9eefb 100644 (file)
@@ -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
index f13f1e1..32a552d 100755 (executable)
@@ -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" };
     }