Home » XML » XML_Beautifier » Bug #220
& Break after process
Details
| Submitted | 2003-11-10 10:01 UTC |
|---|---|
| From | saran at inra dot co dot th |
| Assigned | schst |
| Status | Closed |
| Package | XML_Beautifier |
| PHP Version | 4.3.3 |
| OS | Windows XP |
| Roadmaps | (Not assigned) |
Comments
[2003-11-10 10:01 UTC] saran at inra dot co dot th
Description:
------------
When pass xml string that has '&' characters to formatString function, it will break to '& AMP;' (Note the space) and thus make this xml invalid.
Reproduce code:
---------------
$store="mark & spencer";
$store=htmlentities($store); // now store=='mark & spencer'
require_once('xml/beautifier.php');
$bf=new XML_Beautifier();
$xml="<?xml version=\"1.0\"?><root><store>$store</store></root>";
$xml=$bf->formatString($xml);
echo $xml;
Expected result:
----------------
<?xml version="1.0"?>
<root>
<store>mark & spencer</store>
</root>
Actual result:
--------------
<?xml version="1.0"?>
<root>
<store>mark & amp; spencer</store>
</root>
[2003-11-11 02:14 UTC] saran at inra dot co dot th
Please accept my apologies, there is my fault in the first post. I did htmlentities() twice that's why it look like '& AMP;' breaks. But coincidently there is missing special characters treatment routine at that point and it is now fixed in CVS. Thanks for your prompt response and I will be more careful in the next post.