PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_Beautifier » Bug #220

& Break after process

Details

Submitted2003-11-10 10:01 UTC
Fromsaran at inra dot co dot th
Assignedschst
StatusClosed
PackageXML_Beautifier
PHP Version4.3.3
OSWindows 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.