Bug #14850: Problems with XML and DTD entities

From: Date: Fri, 04 Jan 2002 15:09:38 +0000
Subject: Bug #14850: Problems with XML and DTD entities
Groups: php.dev 
Request: Send a blank email to php-dev+get-75875@lists.php.net to get a copy of this message
From: mark@chesneycorp.com Operating system: FreeBSD 4.5-PRERELEASE PHP version: 4.1.1 PHP Bug Type: DOM XML related Bug description: Problems with XML and DTD entities There are two instances where I am having problems with entities. test.php and test.xml below exhibit a problem with xml entities. The output is: Blah Blah &Acirc;&reg; Blah Blah The expected output was: Blah Blah &reg; Blah Blah The second problem exhibited by test2.php and test2.xml has to do with DTD entities. The output is: Blah Blah The expected output was: Blah Blah &reg; Blah Blah The setup is PHP 4.1.1 with a patch to php_domxml.c from 1.67.2.9 to 1.90 that fixes a problem with PHP crashing with DTD entities. test.php: -- <? $xml = "test.xml"; $doc = xmldocfile($xml); $context = $doc->xpath_new_context(); $query = "//test"; $nodes = $context->xpath_eval($query); $node = $nodes->nodeset[0]->children(); $content .= $node[0]->content; echo htmlentities($content); ?> test.xml: -- <?xml version="1.0"?> <test>Blah Blah &#174; Blah Blah</test> test2.php: -- <? $xml = "test2.xml"; $doc = xmldocfile($xml); $context = $doc->xpath_new_context(); $query = "//test"; $nodes = $context->xpath_eval($query); $node = $nodes->nodeset[0]->children(); $content .= $node[0]->content; echo htmlentities($content); ?> test2.xml: -- <?xml version="1.0"?> <!DOCTYPE test [ <!ENTITY reg "&#174;"> ]> <test>Blah Blah &reg; Blah Blah</test> -- Edit bug report at: http://bugs.php.net/?id=14850&edit=1

« previous php.dev (#75875) next »