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

Bug #16153 XML Entities are removed entirely
Submitted: 2009-04-27 07:29 UTC
From: galiganu Assigned:
Status: Open Package: XML_Serializer (version 0.19.2)
PHP Version: Irrelevant OS: SunOS
Roadmaps: 0.21.0    
Subscription  


 [2009-04-27 07:29 UTC] galiganu (Ionut Aivanesei)
Description: ------------ I have the a xml file (test.xml) containing following: <?xml version="1.0" encoding="utf-8" ?> <applications> <application> <id>1</id> <application_name>A&B</application_name> </application> </applications> When trying to unserialize it the '&' is removed from the string (entirely). Please note that everything goes OK on my Windows PC (with same package and php version). Only on the solaris server I have this issue. Test script: --------------- <?php $options = array( 'complexType' => 'array', 'parseAttributes' => false, 'whitespace' => XML_UNSERIALIZER_WHITESPACE_TRIM, 'guessTypes' => false); $unserializer = &new XML_UNserializer($options); $result = $unserializer->unserialize('test.xml', true); if ($result === true) { $data = $unserializer->getUnserializedData(); } ?> Expected result: ---------------- Array ( [application] => Array ( [id] => 1 [application_name] => A&B ) ) Actual result: -------------- Array ( [application] => Array ( [id] => 1 [application_name] => AB ) )

Comments

 [2009-04-27 07:33 UTC] galiganu (Ionut Aivanesei)
Please note that I used in the xml the entity &amp;, but the bug description it doesn't decode it correctly.
 [2009-04-27 15:13 UTC] jordic (jordi colelll)
Me too! Fedore Core, 8 1) testBugXMLAmpersands(testDocumentXmlDs) Failed asserting that two objects are equal. --- Expected +++ Actual @@ -10,7 +10,7 @@ *RECURSION* [_d:protected] => Array ( - [title] => b&a + [title] => ba [_id] => 49f57845ef39d ) @@ -34,7 +34,7 @@ *RECURSION* [_d:protected] => Array ( - [title] => b&a + [title] => ba [_id] => 49f57845ef39d )
 [2009-05-23 23:12 UTC] doconnor (Daniel O'Connor)
See solution/workaround in Bug #16154
 [2012-03-28 04:28 UTC] jk3us (Jay Knight)
We've just started experiencing this is in version 0.20.2. We recently did a system upgrade, I'm not sure what version we had before. The workaround in #16154 doesn't seem to be helping. Any ideas?