|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48898 readOuterXML() doesn't work on DTDs
Submitted: 2009-07-12 21:41 UTC Modified: 2010-05-04 19:58 UTC
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: boen dot robot at gmail dot com Assigned:
Status: Not a bug Package: XML Reader
PHP Version: 5.3.0 OS: Windows Vista Ultimate x64 SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: boen dot robot at gmail dot com
New email:
PHP Version: OS:


 [2009-07-12 21:41 UTC] boen dot robot at gmail dot com
When reading an XML document with XMLReader, you can't use readOuterXML() to read the value of some node types, DTD being the most noticeable and disturbing one.

While for readInnerXML(), the "inner" part may be hard to define in those node types, the "outer" is always clearly the whole node, and all of its descendants.

If the root of the problem is in libxml, may I ask the maintainers of this extension to forward this to libxml's authors? I'm not a C user of libxml, so coming in with a runnable test case for libxml's authors would be hard.

PHP runs on Apache 2.2.9 as CGI, and is the VC6 x86 Thread-safe build (just in case it matters).

Reproduce code:
$reader = new XMLReader;
$reader->XML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
        <title>It works...</title>
        <h1>It works!</h1>
echo $reader->readOuterXML();

Expected result:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

Actual result:
An empty string.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-04 19:58 UTC]
-Status: Open +Status: Bogus
 [2010-05-04 19:58 UTC]
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 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.

The problem lies within libxml2. Bug is being handled there.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 12:01:23 2021 UTC