php.net |  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
Votes:4
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
---------------
<?php
$reader = new XMLReader;
$reader->XML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>It works...</title>
    </head>
    <body>
        <h1>It works!</h1>
    </body>
</html>');
$reader->read();
echo $reader->readOuterXML();
?>

Expected result:
----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Actual result:
--------------
An empty string.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

The problem lies within libxml2. Bug is being handled there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC