#42462 [Opn->Fbk]: Segmentation when trying to set an attribute in a DOMElement
| From: | scottmac@php.net | Date: | Tue, 28 Aug 2007 16:36:08 +0000 |
| Subject: | #42462 [Opn->Fbk]: Segmentation when trying to set an attribute in a DOMElement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116774@lists.php.net to get a copy of this message | ||
ID: 42462
Updated by: scottmac@php.net
Reported By: romain dot lalaut at laposte dot net
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: Linux Ubuntu 2.6.20-16-server
PHP Version: 5.2.4RC3
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-08-28 16:33:08] romain dot lalaut at laposte dot net
Description:
------------
When i try to set an attribute in a DOMElement instance, a segmentation
fault may occurs (not for every element but always the same) .
PHP 5.2.1 (cli) (built: Jul 17 2007 18:14:23)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
My phpinfo() : http://paste-it.net/3324
Reproduce code:
---------------
/* XML code
<div id="one">
<div id="one_a" />
<div id="one_b" />
</div>
<div id="two"></div>
*/
$els = $view->getElementsByXPath(
"/xhtml:html[1]/xhtml:body[1]//xhtml:*[@id]" ); // It works and $els is
an iterator of DOMElement encapsulated in home-made objects
foreach($els as $el)
{
echo('ID : '.$el->getAttribute('id')."\n"); flush();
$el->setAttribute('id', 'foo');
echo("OK\n"); flush();
}
Expected result:
----------------
ID : one
OK
ID : one_a
OK
ID : one_b
OK
ID : two
OK
Actual result:
--------------
ID : one
[Segmentation fault]
GDB backtrace
#0 0x080db409 in php_dom_object_get_data (obj=0x656e6f) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:242
#1 0x080e0140 in node_list_unlink (node=0x656e6f) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:931
#2 0x080e01a0 in node_list_unlink (node=0x8676f20) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:948
#3 0x080e8509 in zif_dom_element_set_attribute (ht=2,
return_value=0x8711f08, return_value_ptr=0x0, this_ptr=0x87101c0,
return_value_used=0) at /tmp/php5.2-200708281430/ext/dom/element.c:308
#4 0x0833fb70 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc12100) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:200
#5 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc12100) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#6 0x0833f6c0 in execute (op_array=0x866bfa4) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#7 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc126b0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#8 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc126b0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#9 0x0833f6c0 in execute (op_array=0x870169c) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#10 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc12ba0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#11 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc12ba0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#12 0x0833f6c0 in execute (op_array=0x86ee670) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#13 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc12d10) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#14 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc12d10) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#15 0x0833f6c0 in execute (op_array=0x86dcff8) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#16 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc13740) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#17 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc13740) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#18 0x0833f6c0 in execute (op_array=0x86dbb84) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#19 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc13c00) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#20 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc13c00) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#21 0x0833f6c0 in execute (op_array=0x85928b4) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#22 0x0833fcea in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc140f0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:234
#23 0x083407bd in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfc140f0) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:322
#24 0x0833f6c0 in execute (op_array=0x8538d2c) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:92
#25 0x0831aaf5 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /tmp/php5.2-200708281430/Zend/zend.c:1134
#26 0x082c6d91 in php_execute_script (primary_file=0xbfc16468) at
/tmp/php5.2-200708281430/main/main.c:1982
#27 0x083944c1 in main (argc=3, argv=0xbfc165d4) at
/tmp/php5.2-200708281430/sapi/cli/php_cli.c:1140
(gdb) frame 4
#4 0x0833fb70 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfc12100) at
/tmp/php5.2-200708281430/Zend/zend_vm_execute.h:200
200 ((zend_internal_function *)
EX(function_state).function)->handler(opline->extended_value,
EX_T(opline->result.u.var).var.ptr,
EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL,
EX(object), return_value_used TSRMLS_CC);
(gdb) frame 3
#3 0x080e8509 in zif_dom_element_set_attribute (ht=2,
return_value=0x8711f08, return_value_ptr=0x0, this_ptr=0x87101c0,
return_value_used=0) at /tmp/php5.2-200708281430/ext/dom/element.c:308
308 node_list_unlink(attr->children TSRMLS_CC);
(gdb) frame 2
#2 0x080e01a0 in node_list_unlink (node=0x8676f20) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:948
948
node_list_unlink((xmlNodePtr) node->properties TSRMLS_CC);
(gdb) frame 1
#1 0x080e0140 in node_list_unlink (node=0x656e6f) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:931
931 wrapper = php_dom_object_get_data(node);
(gdb) frame 0
#0 0x080db409 in php_dom_object_get_data (obj=0x656e6f) at
/tmp/php5.2-200708281430/ext/dom/php_dom.c:242
242 if (obj && obj->_private != NULL) {
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42462&edit=1