From:             murlock42 at gmail dot com
Operating system: Linux Debian Lenny
PHP version:      5.3CVS-2009-03-10 (snap)
PHP Bug Type:     DOM XML related
Bug description:  DOM Xml seems broken when used with DTD

Description:
------------
When I use a XML file with DTD, the root node doesn't have any children
(but xpath query works) and if I removed the DTD, the DOM seems ok

Reproduce code:
---------------
function test( $filename ) { 
  $xml = new DOMDocument();
  $xml->load( $filename, LIBXML_NOBLANKS );

  echo "\n$filename\n";
  echo "Root of XML : " . $xml->firstChild->nodeName . "\n";
  echo "First child of XML Root : " .
$xml->firstChild->firstChild->nodeName . "\n";

  $xpath = new DOMXpath( $xml );

  echo "result of /mame/game xpath query : \n";
  $r = $xpath->query("/mame/game");
  for( $i=0; $i<$r->length; $i++ ) { 
    echo $r->item($i)->nodeName . "\n";
  }

}
test( "file_without_dtd.xml" );
test( "file_with_dtd.xml" );



Expected result:
----------------
with the two XML files: 
file_without_dtd.xml
Root of XML : mame
First child of XML Root : game
result of /mame/game xpath query : 
game

file_with_dtd.xml
Root of XML : mame
First child of XML Root : game
result of /mame/game xpath query : 
game


Actual result:
--------------
file_without_dtd.xml
Root of XML : mame
First child of XML Root : game
result of /mame/game xpath query : 
game

file_with_dtd.xml
Root of XML : mame
First child of XML Root : 
result of /mame/game xpath query : 
game


-- 
Edit bug report at http://bugs.php.net/?id=47612&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47612&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47612&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47612&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47612&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47612&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47612&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47612&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47612&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47612&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47612&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47612&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47612&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47612&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47612&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47612&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47612&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47612&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47612&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47612&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47612&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47612&r=mysqlcfg

Reply via email to