Skip Menu |

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

Report information
The Basics
Id: 47770
Status: new
Priority: 0/
Queue: PHP-Session

People
Owner: Nobody in particular
Requestors: cpan [...] gollum.sytes.net
Cc:
AdminCc:

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



Subject: croak "weird data" for scientific notation
I am encountering Problems with PHP Session data if values are in the scientific notation style 1.0E+6 Example: weird data: d:1.0E+6;summe_in_prozent|d:100;endwert_benchmark|d:1035439; at PHP/Session/Serializer/PHP.pm line 247 This bug was mentioned by a user in "reviews" category before regarding version 0.26 but i thought i'd file a bug to bring attention to this bug again. Besides that, great module. thanks.
From: cpan [...] gollum.sytes.net
Hi there, Am Fr 10. Jul 2009, 08:00:55, JeremyMM schrieb: Show quoted text
> I am encountering Problems with PHP Session data if values are in the > scientific notation style > 1.0E+6
i made a few amendmends to PHP/Session/Serializer/PHP.pm so that it now detects scientific notation. At least it works for me. I do know, that the way i did it is most probably not the best/nicest/most elegant way (i guess there is some cool way with sprintf to convert values in scientific notation to a double), but it works for me and i am happy with it. maybe this piece of code is for some use for somebody and maybe that re which i added in @re could be added to the module by the maintainer 'd:(-?\d+(?:\.\d+)?(?:E(?:\-|\+)\d)?);', # double with scientific notation such as d:1.0E+6 jeremy
Subject: PHP.pm-scientific-notation.patch
Index: PHP.pm =================================================================== --- PHP.pm (revision 96) +++ PHP.pm (revision 327) @@ -238,7 +238,8 @@ 'O:(\d+):', # object '(N);', # null 'b:([01]);', # boolean - '[Rr]:(\d+);', # reference count? + '[Rr]:(\d+);', # reference count? + 'd:(-?\d+(?:\.\d+)?(?:E(?:\-|\+)\d)?);', # double with scientific notation such as d:1.0E+6 ); sub parse { @@ -270,7 +271,19 @@ $decoder->process_value($7); } elsif (defined $8) { # reference - $decoder->process_value($8); + $decoder->process_value($8); + } + elsif (defined $9) { # double with scientific notation + my $val = $9; + if ($val =~ /(-?\d+(?:\.\d+)?)E(\-|\+)(\d)/) { + my ($double,$sign,$exp) = ($1,$2,$3); + if ($sign eq "-") { $exp = $exp*-1; } + my $val2 = $double*(10**($exp)); + $decoder->process_value($val2); + } + else { + $decoder->process_value($9); + } } }