Changeset 676

Show
Ignore:
Timestamp:
07/16/02 17:07:00
Author:
miyagawa
Message:

bug fix in double/int/string detection/serialization

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PHP-Session/trunk/MANIFEST

    r670 r676  
    1212t/05_create.t 
    1313t/06_hash.t 
     14t/07_int_double.t 
    1415t/lib/TestUtil.pm 
  • PHP-Session/trunk/lib/PHP/Session.pm

    r670 r676  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = '0.11'; 
     5$VERSION = '0.12'; 
    66 
    77use vars qw(%SerialImpl); 
  • PHP-Session/trunk/lib/PHP/Session/Serializer/PHP.pm

    r670 r676  
    55 
    66use vars qw($VERSION); 
    7 $VERSION = '0.11'; 
     7$VERSION = '0.12'; 
    88 
    99sub _croak { require Carp; Carp::croak(@_) } 
     
    1616my $var_re = '(\w+)\|'; 
    1717my $str_re = 's:\d+:"(.*?)";'; 
    18 my $int_re = 'i:(\d+);'; 
    19 my $dbl_re = 'd:([\-\d\.]+);'; 
     18my $int_re = 'i:(-?\d+);'; 
     19my $dbl_re = 'd:(-?[\d\.]+);'; 
    2020my $arr_re = 'a:(\d+):'; 
    2121my $obj_re = 'O:\d+:"(.*?)":\d+:'; 
     
    108108    } 
    109109    elsif (! ref $value) { 
    110         if ($value =~ /^\d+$/) { 
     110        if ($value =~ /^-?\d+$/) { 
    111111            return $self->encode_int($value); 
    112112        } 
    113         elsif ($value =~ /^[\d\-\.]+$/) { 
     113        elsif ($value =~ /^-?[\d\.]+$/) { 
    114114            return $self->encode_double($value); 
    115115        } 
     
    144144sub encode_double { 
    145145    my($self, $value) = @_; 
    146     return sprintf "d:%d;", $value; 
     146    return sprintf "d:%s;", $value; # XXX hack 
    147147} 
    148148