|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-01 09:56 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 08:00:01 2025 UTC |
Description: ------------ Error results when trying to parse an rdf news feed with the listed doctype element. Although this is similar to previous bugs it still seems to be happening with the latest version. I have a workaround that stripps out the offending lines until this is fixed: preg_match("/<rdf:RDF(.*?)>(.*?)<\/rdf:RDF>/s",$output,$match); if($match[0]) { $output = $match[0]; } Reproduce code: --------------- // functions "startElement", "endElement" and "characterData" stripped out for clarity $output = <<<EOF <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ <!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"> %HTMLlat1; ]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"> </rdf:RDF> EOF; $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); if (!xml_parse($xml_parser, $output, true)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free($xml_parser); Expected result: ---------------- Expected no output in above script as the handler functions only output cdata from within the rdf elements Actual result: -------------- XML error: Undeclared entity error at line 5