php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37228 XMLReader never returns XMLReader::XML_DECLARATION nodes
Submitted: 2006-04-27 21:20 UTC Modified: 2006-04-28 12:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dennis at inmarket dot lviv dot ua Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 5CVS-2006-04-27 (snap) OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dennis at inmarket dot lviv dot ua
New email:
PHP Version: OS:

 

 [2006-04-27 21: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)

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-27 21:36 UTC] rrichards@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This is a known issue in libxml2
 [2006-04-28 12:24 UTC] dennis at inmarket dot lviv dot ua
For those who experience this bug and need it to be fixed, please see it filed on PECL http://pecl.php.net/bugs/bug.php?id=7512
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 17:01:29 2024 UTC