Re: Bug #1846 [Asn]: unserialization bug with empty arrays
| From: | Stephan Schmidt | Date: | Mon, 12 Jul 2004 06:29:24 +0000 |
| Subject: | Re: Bug #1846 [Asn]: unserialization bug with empty arrays | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-1638@lists.php.net to get a copy of this message | ||
Hi David,
This bug has been added yesterday!
I assigned it to me, directly after it had been added. I don't think, that it's necessary to remind me after 24 hours.
Stephan
gurugeek@php.net wrote:
Edit report at http://pear.php.net/bugs/bug.php?id=1846&edit=1ID: 1846 Updated by: gurugeek@php.net Reported By: apinstein at showcaseRE dot com Status: Assigned Type: Bug Package: XML_SerializerOperating System: mac os x / 10.3.4PHP Version: 4.3.6 Assigned To: schstNew Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2004-07-11 14:01:34] 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. ------------------------------------------------------------------------