ID: 35271 User updated by: bugs dot php dot net at nanonanonano dot net Reported By: bugs dot php dot net at nanonanonano dot net Status: Open -Bug Type: Feature/Change Request +Bug Type: *XML functions Operating System: Linux PHP Version: 4CVS-2005-11-18 (CVS) New Comment:
This has been triaged to "Feature request" but it's a straight bug in the implementation: the docs claim that xml_parse_into_struct parses XML into a pair of arrays but the function doesn't do that. (at the very least, a warning should be in the documentation for xml_parse_into_struct that it will fubar your data if you have entities in it, but I'd obviously prefer that the function just worked properly) Previous Comments: ------------------------------------------------------------------------ [2005-11-18 07:17:00] bugs dot php dot net at nanonanonano dot net Description: ------------ When called on an XML document that contains defined entities, xml_parse_into_struct silently drops the entities from the parsed output. (If the entity is undefined, it returns an error) Reproduce code: --------------- <?php $data = implode ("", file('entityexample.xml')); $parser = xml_parser_create(); xml_parser_set_option ($parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option ($parser,XML_OPTION_SKIP_WHITE,1); xml_parse_into_struct ($parser,$data,$values,$tags); xml_parser_free ($parser); #echo "VALS\n"; print_r($values); #echo "TAGS\n"; print_r($tags); echo $values[2]['value']."\n"; ?> ---------- entityexample.xml -------------- <?xml version='1.0'?> <!DOCTYPE test [ <!ENTITY times "FOO BAR"> ]> <test> <item> <name>One × two</name> </item> </test> Expected result: ---------------- The entity should either be not replaced: One × two or it should be correctly replaced: One FOO BAR two Actual result: -------------- The entity is silently dropped from the XML stream: One two ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35271&edit=1