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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 06:01:32 2025 UTC