|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-31 19:13 UTC] php at owenpshaw dot net
Description:
------------
As near as I can tell, a DomDocument object causes a crash when it is unset. I cannot duplicate the crash with any other kind of object.
Reproduce code:
---------------
1)
$d = DomDocument::load('test.xml');
2)
$d = DomDocument::load('test.xml');
var_dump($d);
3)
$d = DomDocument::load('test.xml');
$d = DomDocument::load('test.xml');
var_dump($d);
Expected result:
----------------
1)
(nothing)
2)
object(DOMDocument)#1 (0) {
}
3)
object(DOMDocument)#2 (0) {
}
Actual result:
--------------
1)
Segmentation fault
2)
object(DOMDocument)#1 (0) {
}
Segmentation fault
3)
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 13:00:01 2026 UTC |
#0 0xb7305f7f in _int_free () from /lib/tls/libc.so.6 #1 0xb7304f78 in free () from /lib/tls/libc.so.6 #2 0xb741bc4c in xmlFreeNodeList () from /usr/lib/libxml2.so.2 #3 0xb741944d in xmlFreeDoc () from /usr/lib/libxml2.so.2 #4 0x08083b9b in php_libxml_decrement_doc_ref (object=0x848c1a4) at /home/oshaw/build/php-5.1.0RC1/ext/libxml/libxml.c:898 #5 0x080ab886 in dom_objects_free_storage (object=0x848c1a4) at /home/oshaw/build/php-5.1.0RC1/ext/dom/php_dom.c:904 #6 0x08286580 in zend_objects_store_del_ref (zobject=0x847a3bc) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_objects_API.c:161 #7 0x0826af34 in _zval_dtor_func (zvalue=0x847a3bc, __zend_filename=0x834c460 "/home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.h", __zend_lineno=35) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.c:52 #8 0x08262a1e in _zval_dtor (zvalue=0x847a3bc, __zend_filename=0x834bf80 "/home/oshaw/build/php-5.1.0RC1/Zend/zend_execute_API.c", __zend_lineno=386) at zend_variables.h:35 #9 0x08260138 in _zval_ptr_dtor (zval_ptr=0x8487858, __zend_filename=0x834d0e0 "/home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.c", __zend_lineno=175) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_execute_API.c:386 #10 0x0826b198 in _zval_ptr_dtor_wrapper (zval_ptr=0x8487858) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.c:175 #11 0x08274c8c in zend_hash_apply_deleter (ht=0x83da930, p=0x848784c) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_hash.c:574 #12 0x08274eb1 in zend_hash_graceful_reverse_destroy (ht=0x83da930) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_hash.c:640 #13 0x0825fb00 in shutdown_executor () at /home/oshaw/build/php-5.1.0RC1/Zend/zend_execute_API.c:216 #14 0x0826c4f9 in zend_deactivate () at /home/oshaw/build/php-5.1.0RC1/Zend/zend.c:823 #15 0x0822b1e0 in php_request_shutdown (dummy=0x0) at /home/oshaw/build/php-5.1.0RC1/main/main.c:1238 #16 0x082d8c33 in main (argc=2, argv=0xbfffdfd4) at /home/oshaw/build/php-5.1.0RC1/sapi/cli/php_cli.c:1142<?php $d = DomDocument::load('test.xml'); ?> ------ test.xml <?xml version="1.0"?> <test/> I know it doesn't seem like this should cause a crash. I would say that it's my system, but php 5.0.4 works just fine, as did earlier 5.1 builds. I've also checked the latest 5.1 snapshot and it crashes.What version of libxml2? Can you try doing the following and see if it crashes: $dom = new DOMDocument(); $dom->load('test.xml'); also try the following: $sxe = simplexml_load_file('test.xml');libxml2-2.6.6 <?php $d = new DomDocument(); $d->load('test.xml'); ?> does not crash <?php $d = new DomDocument(); $d->load('test.xml'); $d = null; ?> does crash, with a similar backtrace: #0 0xb749ae0c in xmlDictOwns () from /usr/lib/libxml2.so.2 #1 0xb7419333 in xmlFreeDoc () from /usr/lib/libxml2.so.2 #2 0x08083b9b in php_libxml_decrement_doc_ref (object=0x848c21c) at /home/oshaw/build/php-5.1.0RC1/ext/libxml/libxml.c:898 #3 0x080ab886 in dom_objects_free_storage (object=0x848c21c) at /home/oshaw/build/php-5.1.0RC1/ext/dom/php_dom.c:904 #4 0x08286580 in zend_objects_store_del_ref (zobject=0x84863cc) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_objects_API.c:161 #5 0x0826af34 in _zval_dtor_func (zvalue=0x84863cc, __zend_filename=0x8356a00 "/home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.h", __zend_lineno=35) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_variables.c:52 #6 0x082d501e in _zval_dtor (zvalue=0x84863cc, __zend_filename=0x8351960 "/home/oshaw/build/php-5.1.0RC1/Zend/zend_execute.c", __zend_lineno=814) at zend_variables.h:35 #7 0x082d6c19 in zend_assign_to_variable (result=0x848b118, op1=0x848b12c, op2=0x848b140, value=0xbfffbd18, type=2, Ts=0xbfffbca0) at /home/oshaw/build/php-5.1.0RC1/Zend/zend_execute.c:814 #8 0x082caec5 in ZEND_ASSIGN_SPEC_CV_TMP_HANDLER (execute_data=0xbfffbd40) at zend_vm_execute.h:22140 #9 0x082930ef in execute (op_array=0x8486c54) at zend_vm_execute.h:87 #10 0x0826cd43 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/oshaw/build/php-5.1.0RC1/Zend/zend.c:1078 #11 0x0822bd76 in php_execute_script (primary_file=0xbfffe160) at /home/oshaw/build/php-5.1.0RC1/main/main.c:1672 #12 0x082d881c in main (argc=2, argv=0xbfffe244) at /home/oshaw/build/php-5.1.0RC1/sapi/cli/php_cli.c:1039 Simplexml does not crash