ID:               31200
 Updated by:       [EMAIL PROTECTED]
 Reported By:      diodu at keliglia dot com
-Status:           Open
+Status:           Verified
 Bug Type:         DOM XML related
 Operating System: Linux debian
 PHP Version:      5.0.3
 New Comment:

libxml2 does automatically resolve external entities, and I didn't find
a way to turn that off from the php side... 

We have to investigate the issue, it's not only annoying, but also a
performance bottleneck




Previous Comments:
------------------------------------------------------------------------

[2004-12-20 14:03:19] diodu at keliglia dot com

Description:
------------
When trying to xinclude an XML file with an attached DTD,
DOMDocument->xinclude() outputs a part of the DTD in the result.
Deleting the Doctype line in the included file fix the problem.

Reproduce code:
---------------
<?php
// book.xml being the XML file described here:
http://livedocs.phpdoc.info/index.php?l=en&q=ref.dom#dom.examples


$xml =<<<EOD
<?xml version="1.0" ?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude";>
 <title>Books of the other guy..</title>
 <para>
  <xi:include
href="book.xml#xpointer(/book/chapter/para/informaltable/tgroup/tbody/*)"
parse="xml">
   <xi:fallback>
    <error>xinclude: book.xml not found</error>
   </xi:fallback>
  </xi:include>
 </para>
</chapter>
EOD;

$dom = new DOMDocument;
$dom->loadXML($xml);

$dom->xinclude();

echo $dom->saveXML();

?>

Expected result:
----------------
<?xml version="1.0"?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude";>
 <title>Books of the other guy..</title>
 <para>
  <row xml:base="/home/didou/book.xml">
       <entry>The Grapes of Wrath</entry>
       <entry>John Steinbeck</entry>
       <entry>en</entry>
       <entry>0140186409</entry>
      </row><row xml:base="/home/didou/book.xml">
       <entry>The Pearl</entry>
       <entry>John Steinbeck</entry>
       <entry>en</entry>
       <entry>014017737X</entry>
      </row><row xml:base="/home/didou/book.xml">
       <entry>Samarcande</entry>
       <entry>Amine Maalouf</entry>
       <entry>fr</entry>
       <entry>2253051209</entry>
      </row>
 </para>
</chapter>


Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE chapter [
<!ENTITY uArr "â">
<!ENTITY hcirc "Ä¥">
<!ENTITY icirc "î">
<!ENTITY equals "=">
<!ENTITY cong "â
">
<!ENTITY icy "О">

// a hundred of similar lines

<!ENTITY sstarf "â">
<!ENTITY samalg "âThe Grapes of Wrath</entry>
       <entry>John Steinbeck</entry>
       <entry>en</entry>
       <entry>0140186409</entry>
      </row><row xml:base="/home/didou/book.xml">
       <entry>The Pearl</entry>
       <entry>John Steinbeck</entry>
       <entry>en</entry>
       <entry>014017737X</entry>
      </row><row xml:base="/home/didou/book.xml">
       <entry>Samarcande</entry>
       <entry>Amine Maalouf</entry>
       <entry>fr</entry>
       <entry>2253051209</entry>
      </row>
 </para>
</chapter>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31200&edit=1

Reply via email to