Changeset 936

Show
Ignore:
Timestamp:
10/05/03 05:35:40
Author:
miyagawa
Message:

0.21

Files:

Legend:

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

    r881 r936  
    11Revision history for Perl extension PHP::Session 
    22 
    3 0.20 
     30.22  Sun Oct  5 05:33:32 JST 2003 
     4        * Fixed bug that it fails to decode strings longer than 32766 bytes 
     5          (https://rt.cpan.org/Ticket/Display.html?id=3970) 
     6 
     70.21  Wed Oct  1 08:19:55 JST 2003 
     8        * Fixed bug that it decodes "0123" as integer 123. 
     9          (https://rt.cpan.org/Ticket/Display.html?id=3917) 
     10 
     110.20  Tue Apr 15 13:15:36 JST 2003 
    412        - Minor pod fix 
     13        * Fixed bug which fails to decode session data with "\n" in it 
     14          (Thanks to Andy Lester) 
    515 
    6160.19  Tue Feb 25 19:21:10 JST 2003 
  • PHP-Session/trunk/MANIFEST

    r881 r936  
    11Changes 
    2 MANIFEST 
    3 Makefile.PL 
    4 README 
    52lib/PHP/Session.pm 
    63lib/PHP/Session/Serializer/PHP.pm 
     4Makefile.PL 
     5MANIFEST 
     6META.yml                        Module meta-data (added by MakeMaker) 
     7README 
    78t/00_compile.t 
    89t/01_deserialize.t 
     
    1819t/11_bracket.t 
    1920t/12_newline.t 
     21t/13_length.t 
    2022t/lib/TestUtil.pm 
    2123t/sess_bracket 
  • PHP-Session/trunk/lib/PHP/Session.pm

    r881 r936  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = q(0.20)
     5$VERSION = 0.22
    66 
    77use vars qw(%SerialImpl); 
  • PHP-Session/trunk/lib/PHP/Session/Serializer/PHP.pm

    r881 r936  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = q(0.20)
     5$VERSION = 0.22
    66 
    77sub _croak { require Carp; Carp::croak(@_) } 
     
    9999sub is_int { 
    100100    local $_ = shift; 
    101     /^-?[0-9]\d{0,8}$/; 
     101    /^-?(0|[1-9]\d{0,8})$/; 
    102102} 
    103103 
    104104sub is_float { 
    105105    local $_ = shift; 
    106     /^-?[0-9]\d{0,8}\.\d+$/; 
     106    /^-?(0|[1-9]\d{0,8})\.\d+$/; 
    107107} 
    108108 
     
    276276    my($self, $decoder) = @_; 
    277277    my $length = $decoder->pop_stack(); 
    278     $decoder->{buffer} =~ s/^"(.{$length})";//s or $decoder->weird; 
    279     $decoder->process_value($1); 
     278 
     279    # .{$length} has a limit on length 
     280    # $decoder->{buffer} =~ s/^"(.{$length})";//s or $decoder->weird; 
     281    my $value = substr($decoder->{buffer}, 0, $length + 3, ""); 
     282    $value =~ s/^"// and $value =~ s/";$// or $decoder->weird; 
     283    $decoder->process_value($value); 
    280284} 
    281285 
     
    306310    my($self, $decoder) = @_; 
    307311    my $length = $decoder->pop_stack(); 
    308     $decoder->{buffer} =~ s/^"(.{$length})":(\d+):// or $decoder->weird; 
    309     $decoder->start_array($2, $1); # $length, $class 
     312#    $decoder->{buffer} =~ s/^"(.{$length})":(\d+):// or $decoder->weird; 
     313    my $value = substr($decoder->{buffer}, 0, $length + 3, ""); 
     314    $value =~ s/^"// and $value =~ s/":$// or $decoder->weird; 
     315    $decoder->{buffer} =~ s/^(\d+):// or $decoder->weird; 
     316    $decoder->start_array($1, $value); # $length, $class 
    310317    $decoder->change_state('ArrayStart'); 
    311318} 
  • PHP-Session/trunk/t/09_int_str.t

    r852 r936  
    11use strict; 
    2 use Test::More tests => 1
     2use Test::More tests => 5
    33 
    44use lib 't/lib'; 
     
    88 
    99my $sid = "12345"; 
    10 my $date_str = '20030224000000'; 
    1110 
    12 
    13     my $session = PHP::Session->new($sid, { create => 1, save_path => 't' }); 
    14     $session->set(created => $date_str); 
    15     $session->save(); 
    16 
     11my @tests = qw(20030224000000 012345 1.4 01.4 123545); 
    1712 
    18 
    19     my $session = PHP::Session->new($sid, { save_path => 't' }); 
    20     is $session->get('created'), $date_str, "date str is back"; 
    21     $session->destroy(); 
     13for my $test (@tests) { 
     14    { my $session = PHP::Session->new($sid, { create => 1, save_path => 't' }); 
     15      $session->set(text => $test); 
     16      $session->save(); } 
     17 
     18    { my $session = PHP::Session->new($sid, { save_path => 't' }); 
     19      is $session->get('text'), $test, "testdata is $test"; 
     20      $session->destroy(); } 
    2221} 
    2322