From:             [EMAIL PROTECTED]
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 ® Blah Blah

The expected output was:
Blah Blah ® 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 ® 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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to