|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26813 getElementById doesn't return anything
Submitted: 2004-01-06 08:32 UTC Modified: 2004-01-07 11:36 UTC
From: msw at seebi dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.0b3 (beta3) OS: windows xp prof
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: msw at seebi dot de
New email:
PHP Version: OS:


 [2004-01-06 08:32 UTC] msw at seebi dot de
I'v used getElementById() to touch an element. It seems to me that getElementById() doesn't return anything. 

Reproduce code:
$dom = new domdocument;
if(!$dom) {
  echo "Error while parsing the document\n";

print ($node);


<?xml version="1.0" encoding="iso-8859-1"?>
<news id="486" rubrik='xsl-fo' site="javaxml">
 <headline>Kleines Update von XEP</headline>
  <Web-Adresse xml:link='simple' href=''>
   <text>XEP 3.5.4</text>

Expected result:
The PHP code should print out the node name (news)

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-06 12:51 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

DTD required to use id
 [2004-01-07 03:08 UTC] msw at seebi dot de
Thats not the correct behaviour according to W3C. I know this behaviour because it is also used in PHP 4.x. You should fix this to get more compatability with DOM. getElementById() should work without DTD.
 [2004-01-07 06:31 UTC]
Re-read the specs (this is the same as in Level 2 specs)
'Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.'
 [2004-01-07 11:36 UTC] msw at seebi dot de
You are right, I didn't read the note in the specs. Sorry for my reply.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 06 22:02:20 2021 UTC