|  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.
Block user comment
Status: Assign to:
Bug Type:
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
$xmldoc = new DOMDocument();
I get for
echo "item 0=".$xmldoc->childNodes->item(0)->nodeName."\n";
echo "root =".$xmldoc->document_element->nodeName."\n";
the output:
item 0=a
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-09 10:53 UTC] ikrabbe dot ask at web dot de
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-2021 The PHP Group
All rights reserved.
Last updated: Tue Jul 27 08:01:24 2021 UTC