Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

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



A warning Odd number of elements in hash assignment at /usr/share/perl5/PHP/Serialization.pm line 180. is generated when de-serializing the following string. I am not that versed in PHP to know if the string is botched or is it a problem with P::S. my $encoded_php = 'a:2:{s:15:"info_buyRequest";a:5:{s:4:"uenc";s:72:"aHR0cDovL3N0YWdpbmcucGNkaXJlY3QuY29tL21vbml0b3JzL2Jsc2FzeTIwMjB3aS5odG1s";s:7:"product";s:3:"663";s:15:"related_product";s:0:"";s:7:"options";a:3:{i:3980;s:5:"12553";i:3981;s:5:"12554";i:3982;s:5:"12555";}s:3:"qty";s:6:"1.0000";}s:7:"options";a:3:{i:0;a:8:{s:5:"label";s:27:"Dead Pixel Checking Service";s:5:"value";s:155:"I understand LCD technology might have slight imperfections. Even a high quality A Grade panel might have up to five dead pixels. Ship without pre-checking";s:9:"option_id";s:4:"3980";s:3:"sku";s:0:"";s:5:"price";N;s:10:"price_type";N;s:3:"raw";O:33:"Mage_Catalog_Model_Product_Option":15:{s:11:"'; Cheers
On Tue Mar 31 10:16:45 2009, RIBASUSHI wrote: Show quoted text
> I am not that versed in PHP to know > if the string is botched or is it a problem with P::S.
Almost certainly a bug in P::S. This module is, unfortunately, almost unmaintained. Patches are, however, welcome.. Cheers t0m
Your serialized string is incomplete: Show quoted text
>{s:11:"';
See? But anyway P::S should return an appropriate error.
Subject: Re: [rt.cpan.org #44700] Deserialization bug
Date: Fri, 29 May 2009 15:44:31 +0100
To: bug-PHP-Serialization [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
http://isage.livejournal.com/ via RT wrote: Show quoted text
> Queue: PHP-Serialization > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=44700 > > > Your serialized string is incomplete:
>> {s:11:"';
> See? > > But anyway P::S should return an appropriate error.
Correct in both cases. Patches welcome? :) Cheers t0m
Show quoted text
> Correct in both cases. Patches welcome? :) > > Cheers > t0m
Ok, i've attached a patch, which makes it possible (i hope) to deserialize even an uncomplete string. To correctly handle incomplete strings (i.e. throw an appropriate error), module needs some preparsing or total rewrite with normal finite-state machine.
198,199c198,199 < < my %value = $self->_parse(); --- > my $ret=$self->_parse(); > my %value = $ret if (ref($ret) eq 'HASH');
I've kinda done a rewrite, debugging something. Not very robust yet though, but I think it has better architecture.
Fixed in the just shipped 0.32