Skip Menu |

This queue is for tickets about the PHP-Serialization CPAN distribution.

Report information
The Basics
Id: 6402
Status: resolved
Priority: 0/
Queue: PHP-Serialization

People
Owner: bobtfish [...] bobtfish.net
Requestors: tom@eborcom.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.27
Fixed in: (no value)



Subject: Problem with unserialize() and negative numbers
unserialize() has problems dealing with negative numbers. The attached patch demonstrates this problem in t/2.t. The patch also fixes the problem in Serialize.pm. Thanks for your work on this module - we have found it very useful for passing data structures between Perl and PHP. Tom
--- t/2.t.orig Mon Feb 23 21:41:17 2004 +++ t/2.t Mon May 24 15:00:02 2004 @@ -5,7 +5,8 @@ use PHP::Serialization qw(unserialize serialize); my $data = { this_is_a_test => 1.23, - second_test => [1,2,3] + second_test => [1,2,3], + third_test => -2, }; my $encoded = serialize($data); is_deeply($data,&unserialize($encoded)); --- lib/PHP/Serialization.pm.orig Mon Feb 23 21:48:40 2004 +++ lib/PHP/Serialization.pm Mon May 24 15:07:21 2004 @@ -270,7 +270,7 @@ my $string; while ( 1 ) { my $char = $self->_readchar(); - if ( $char !~ /^[\d\.]+$/ ) { + if ( $char !~ /^[\-\d\.]+$/ ) { $$cursor--; last; }
Fixed, many thanks!