php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56989 XMLReader never returns XMLReader::XML_DECLARATION nodes
Submitted: 2006-04-28 08:20 UTC Modified: 2006-04-28 08:57 UTC
From: dennis at inmarket dot lviv dot ua Assigned:
Status: Not a bug Package: xmlReader (PECL)
PHP Version: 5_1 CVS-2006-04-28 OS: WinXP
Private report: No CVE-ID: None
 [2006-04-28 08:20 UTC] dennis at inmarket dot lviv dot ua
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).

In addition to that, PHP6 does not recognize the call to XML() method and complains:
PHP Warning:  XMLReader::read(): Load Data before trying to read in [filename:linenumber]

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-28 08:48 UTC] pierre dot php at gmail dot com
When Richard told you in the php bug #37228 that it is a known issue in libxml2, that means it is an issue in libxml2 and not in the extension. Understand, there is no bug in the extension itself and nothing can be done in the extension to fix it.

Create a new bug does not change this fact.
 [2006-04-28 08:57 UTC] dennis at inmarket dot lviv dot ua
Sorry, my fault, didn't notice the last sentence under that standard reply thingy.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC