From: dennis at inmarket dot lviv dot ua
Operating system: WinXP
PHP version: 5CVS-2006-04-27 (snap)
PHP Bug Type: *XML functions
Bug description: XMLReader never returns XMLReader::XML_DECLARATION nodes
Description:
------------
XMLReader never returns XMLReader::XML_DECLARATION nodes in a call to
XMLReader::read() (silently skips them, however, complains about
well-formedness if the XML declaration is not at the very beginning of the
XML, ie, after a comment or the DTD)
Reproduce code:
---------------
<?php
$xmld = <<<EOT
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Prolog comment 1-->
<!DOCTYPE chapter [
<!ELEMENT chapter (title,para+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT para (#PCDATA)>
]>
<!-- prolog comment 2-->
<!-- prolog comment 3-->
<chapter><title>Title</title><para>Para</para></chapter>
EOT;
$xml = new XMLReader();
$xml->XML($xmld);
while($xml->read()) {
echo "$xml->nodeType \n";
}
?>
Expected result:
----------------
17 <- the nodeType value for XMLReader::XML_DECLARATION
8
10
8
8
1
1
3
15
1
3
15
15
Actual result:
--------------
8
10
8
8
1
1
3
15
1
3
15
15
--
Edit bug report at http://bugs.php.net/?id=37228&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37228&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37228&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37228&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37228&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37228&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37228&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37228&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37228&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37228&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37228&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37228&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37228&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37228&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37228&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37228&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37228&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37228&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37228&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37228&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37228&r=mysqlcfg