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

Bug #16204 Inconsistent data when FORCE_ENUM is on
Submitted: 2009-05-07 23:09 UTC
From: ifeghali Assigned:
Status: Open Package: XML_Serializer (version 0.19.2)
PHP Version: 5.1.6 OS: CentOS 5.3
Roadmaps: 0.21.0    
Subscription  


 [2009-05-07 23:09 UTC] ifeghali (Igor Feghali)
Description: ------------ When force enum is on, if one serialize an empty array and unserialize it back one will end up with an array with a single empty element. Test script: --------------- <?php require_once 'PEAR.php'; require_once 'XML/Serializer.php'; require_once 'XML/Unserializer.php'; $xml = 'test.xml'; /* SERIALIZE */ $options = array( XML_SERIALIZER_OPTION_MODE => 'simplexml', XML_SERIALIZER_OPTION_ROOT_NAME => 'foo', XML_SERIALIZER_OPTION_RETURN_RESULT => true, ); $serializer =& new XML_Serializer($options); $data = array('bar' => array()); $result = $serializer->serialize($data); $fxml = @fopen("$xml", 'w'); fwrite($fxml, $result); /* UNSERIALIZE */ $options = array( XML_UNSERIALIZER_OPTION_FORCE_ENUM => array('bar'), ); $unserializer =& new XML_Unserializer($options); $result = $unserializer->unserialize($xml, true); $result = $unserializer->getUnserializedData(); print_r($result); ?> Expected result: ---------------- Array ( [bar] => Array ( ) ) Actual result: -------------- Array ( [bar] => Array ( [0] => ) )

Comments