Subject: | [PATCH] unserialize failures |
Date: | Thu, 7 Jun 2007 01:34:37 -0400 |
To: | bugs-Apache-Session [...] rt.cpan.org |
From: | Rick Delaney <rick [...] bort.ca> |
Storable::thaw() returns undef for certain kinds of failures instead of
exceptions. For example,
use Storable qw(nfreeze thaw);
my $x = nfreeze([0]);
chop $x;
print "undef\n" unless defined thaw($x);
This can lead to silent session-dropping which is very hard to debug.
My problem was when trying to restore a large session using the MySQL
Store. The session was truncated because I only used a BLOB field when
I needed a LONGBLOB. Because of this, the session data was set to
undef by unserialize (resulting in sending users back to the login
screen). I'd guess that DB_File would suffer from this for large
sessions, too.
I've attached a patch to the Serialize classes which raises an exception
when Storable::thaw() returns undef. Please consider it for your next
release.
Thanks,
--
Rick Delaney
rick@bort.ca
Message body is not shown because sender requested not to inline it.