#42462 [Asn->Csd]: Segmentation when trying to set an attribute in a DOMElement
| From: | rrichards@php.net | Date: | Thu, 30 Aug 2007 16:34:05 +0000 |
| Subject: | #42462 [Asn->Csd]: Segmentation when trying to set an attribute in a DOMElement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116898@lists.php.net to get a copy of this message | ||
ID: 42462
Updated by: rrichards@php.net
Reported By: romain dot lalaut at laposte dot net
-Status: Assigned
+Status: Closed
Bug Type: DOM XML related
Operating System: Linux Ubuntu 2.6.20-16-server
PHP Version: 5.2CVS-2007-08-28
Assigned To: rrichards
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-08-29 09:55:54] jani@php.net
Same backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x080e8785 in php_dom_object_get_data (obj=0x64616568) at
/home/jani/src/php-5.2/ext/dom/php_dom.c:242
242 if (obj && obj->_private != NULL) {
(gdb) bt
#0 0x080e8785 in php_dom_object_get_data (obj=0x64616568) at
/home/jani/src/php-5.2/ext/dom/php_dom.c:242
#1 0x080ed4bc in node_list_unlink (node=0x64616568) at
/home/jani/src/php-5.2/ext/dom/php_dom.c:931
#2 0x080ed51c in node_list_unlink (node=0x8c59438) at
/home/jani/src/php-5.2/ext/dom/php_dom.c:948
#3 0x080f55b1 in zif_dom_element_set_attribute (ht=2,
return_value=0x8c29930, return_value_ptr=0x0, this_ptr=0x8c2903c,
return_value_used=0)
at /home/jani/src/php-5.2/ext/dom/element.c:308
#4 0x08303d68 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfb0a4c4) at
/home/jani/src/php-5.2/Zend/zend_vm_execute.h:200
------------------------------------------------------------------------
[2007-08-29 06:15:58] romain dot lalaut at laposte dot net
For your information, if I import the nodes and copy them into an
another document, there is no problem even with LIBXML_COMPACT
------------------------------------------------------------------------
[2007-08-29 06:09:23] romain dot lalaut at laposte dot net
<?php
$xml = <<<foo
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div id="container">
<div id="header"></div>
<div id="content"></div>
</div>
<div id="footer">
</div>
</body>
</html>
foo;
$doc = new DOMDocument( '1.0.', 'utf-8' );
$doc->loadXML( $xml, LIBXML_COMPACT );
$xpath = new DOMXPath( $doc );
$xpath->registerNamespace( 'xhtml', 'http://www.w3.org/1999/xhtml' );
$res = $xpath->query( "/xhtml:html[1]/xhtml:body[1]//xhtml:*[@id]",
$doc->documentElement );
foreach($res as $el)
{
echo('ID : '.$el->getAttribute('id')."\n"); flush();
$el->setAttribute('id', 'foo');
echo("OK\n"); flush();
}
?>
But if i remove LIBXML_COMPAT, it works perfectly...
------------------------------------------------------------------------
[2007-08-28 20:28:16] romain dot lalaut at laposte dot net
Sorry, i'm tired... The version i used for the test is
PHP 5.2.4RC4-dev (cli) (built: Aug 28 2007 17:24:11) (DEBUG)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
And make test report some bugs (4) but not for DOM...
------------------------------------------------------------------------
[2007-08-28 16:36:07] scottmac@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
5.2.1 is relatively old, if you\'re going to report a bug at least try
the latest version.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/42462
--
Edit this bug report at http://bugs.php.net/?id=42462&edit=1