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] gurugeek
Dear Maintainer, Your package xml_serializer has currently 1 open bug. We urge you to take the necessary steps to solve the reported issues at your soonest convenience. If the bug issue hasn’t been addressed yet you are kindly asked to take the necessary steps to ensure a prompt resolution of the problem. If you already addressed the reported problem feel free to change the bug status as soon as possible. Regards David Costa PEAR Quality Assurance pear-qa@lists.php.net
 [2004-07-12 13:41 UTC] schst
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/XML_Serializer