php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48504 document_element contains nothing
Submitted: 2009-06-09 10:48 UTC Modified: 2009-06-09 10:55 UTC
From: ikrabbe dot ask at web dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.9 OS: Linux
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: ikrabbe dot ask at web dot de
New email:
PHP Version: OS:

 

 [2009-06-09 10:48 UTC] ikrabbe dot ask at web dot de
Description:
------------
on
$xml="<a><b>abc</b><c/></a>";
$xmldoc = new DOMDocument();
$xmldoc->loadXML($xml);
I get for
echo "item 0=".$xmldoc->childNodes->item(0)->nodeName."\n";
echo "root =".$xmldoc->document_element->nodeName."\n";
the output:
item 0=a
root=
I assumed that document_element should be the same as childNodes->item(0), so I assume that is a bug.


Reproduce code:
---------------
see above

Expected result:
----------------
see above

Actual result:
--------------
see above

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-09 10:53 UTC] ikrabbe dot ask at web dot de
Actually:
if ( !$xmldocu->document_element )
  echo "NULL Document";
reveals a NULL root node !  Thats actually a bug.  Please either correct this behaviour or describe whats meant by "document_element" in the documentation.
 [2009-06-09 10:55 UTC] ikrabbe dot ask at web dot de
Sorry, I misspelled the item: document_element is called documentElement.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 09:01:23 2020 UTC