php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37456 DOMElement->setAttribute() loops forever (node_list_unlink bug?)
Submitted: 2006-05-16 07:35 UTC Modified: 2006-05-17 16:38 UTC
From: riku at palomaki dot fi Assigned: rrichards (profile)
Status: Closed Package: DOM XML related
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
 [2006-05-16 07:35 UTC] riku at palomaki dot fi
Description:
------------
That another setAttribute() -call never finishes, and the script will just eventually die because of "PHP Fatal error:  Maximum execution time.." I have tried this with cgi and cli versions of PHP 5.1.4, 5.1.1 and 5.0.5 on different servers (and different ISPs).

When running, php-process takes all CPU. I tried to debug it with gdb and node_list_unlink seems to be calling itself forever.

Reproduce code:
---------------
$doc = new DOMDocument();
$doc->resolveExternals = true;
$doc->loadXml('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><a b="" />');

$root = $doc->getElementsByTagName('a')->item(0);
$root->setAttribute('b', '&gt;');
$root->setAttribute('b', '');

// This will never be executed
echo "done\n";

Expected result:
----------------
Script prints "done\n"

Actual result:
--------------
Fatal error: Maximum execution time of 180 seconds exceeded in phpbug.php on line 8 (that is the another setAttribute-call)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-16 11:04 UTC] rrichards@php.net
assign to self
 [2006-05-17 16:38 UTC] rrichards@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC