Bug #14850 Updated: Problems with XML and DTD entities

From: Date: Fri, 04 Jan 2002 18:39:39 +0000
Subject: Bug #14850 Updated: Problems with XML and DTD entities
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-75889@lists.php.net to get a copy of this message
ID: 14850 Updated by: mfischer Reported By: mark@chesneycorp.com Status: Open Bug Type: DOM XML related Operating System: FreeBSD 4.5-PRERELEASE PHP Version: 4.1.1 New Comment: About Example 2: Entity references defined in the document are their own nodes. You should carefully look at print_r($node); Next please don't open one report about two things (even if they look the same). Previous Comments: ------------------------------------------------------------------------ [2002-01-04 10:09:37] mark@chesneycorp.com 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 this bug report at http://bugs.php.net/?id=14850&edit=1

« previous php.dev (#75889) next »