|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48339 DOMElement::setIdAttribute() throws 'Not Found Error' exception
Submitted: 2009-05-19 23:17 UTC Modified: 2009-06-04 01:00 UTC
Avg. Score:4.6 ± 0.7
Reproduced:13 of 13 (100.0%)
Same Version:5 (38.5%)
Same OS:2 (15.4%)
From: greatwhitepine at bigfoot dot com Assigned: rrichards (profile)
Status: No Feedback Package: DOM XML related
PHP Version: 5.2.9 OS: opensuse 11.1
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: greatwhitepine at bigfoot dot com
New email:
PHP Version: OS:


 [2009-05-19 23:17 UTC] greatwhitepine at bigfoot dot com
DOMElement::setIdAttribute() is broken in 5.2.9.  It works properly in 5.2.6.

Reproduce code:

    // php_dom_setidattribute_bug.php

    $obj_domDocument = new DOMDocument( );

    $obj_domElement = $obj_domDocument->createElement( 'test', 'This is the root element!' );

    $obj_domElement = $obj_domDocument->appendChild( $obj_domElement );

    $obj_domElement->setAttribute( 'xml:id', 1 );

    $obj_domElement->setIdAttribute( 'xml:id', TRUE );

    print $obj_domDocument->saveXML( );


Expected result:
This should not throw any exception.

Actual result:
PHP Fatal error:  Uncaught exception 'DOMException' with message 'Not Found Error' in /home/gwp/bin/php_dom_setidattribute_bug.php:13
Stack trace:
#0 /home/gwp/bin/php_dom_setidattribute_bug.php(13): DOMElement->setIdAttribute('xml:id', true)
#1 {main}
  thrown in /home/gwp/bin/php_dom_setidattribute_bug.php on line 13

Fatal error: Uncaught exception 'DOMException' with message 'Not Found Error' in /home/gwp/bin/php_dom_setidattribute_bug.php:13


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-27 14:53 UTC]
Did you upgrade libxml2 while upgrading PHP? The has been no change in 
the setIdAttribute() method.
 [2009-06-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-10-16 14:13 UTC] jeroen at tietema dot net
I can confirm this issue on Archlinux running PHP 5.3.0 and on Ubuntu 
9.04 with PHP 5.2.6-3ubuntu4.2
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 23:01:30 2024 UTC