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

Bug #16204 Inconsistent data when FORCE_ENUM is on
Submitted: 2009-05-08 04: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  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 42 - 34 = ?

 
 [2009-05-08 04: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