Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.21.0

Bug #1846 unserialization bug with empty arrays
Submitted: 2004-07-11 18:01 UTC
From: apinstein at showcaseRE dot com Assigned: schst
Status: Closed Package: XML_Serializer
PHP Version: 4.3.6 OS: mac os x / 10.3.4
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-11 18:01 UTC] apinstein at showcaseRE dot com
Description: ------------ I am using 0.10 of XML_Serializer (and XML_Unserializer) to serialize PHP objects into a database. I found a small "warning" bug.... if you serialize an array which is EMPTY, it gets transformed into valid XML: <autopage_options _class="autopage_options" _type="object"> <version _type="string">1.0</version> <options _type="array" /> </autopage_options> However, upon unserialization, a php-notice error: Notice: Undefined index: children in /usr/local/php/lib/ php/XML/Unserializer.php on line 419 It seems to be fixed by patching like so: /* * unserialize an array */ case "array": if ($data !== '') { $value["children"][$this- >options["contentName"]] = $data; } // add IF to only do assign if the value exists if (isset($value["children"])) $value["value"] = $value["children"]; break; Expected result: ---------------- I would expect that you could serialize / unserialize an empty array safely and without warning / error.

Comments

 [2004-07-11 22:55 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-07-12 13:41 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!