|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-06-27 21:03 UTC] tony2001@php.net
[2008-03-12 13:40 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
Description: ------------ When creating a class that extends RecursiveIteratorIterator, it causes a sefault if the __construct() method of the new class does not call RecursiveIteratorIterator::__construct(). I'm reporting this bug because I would expect to see PHP throw a fatal error about RecursiveIteratorIterator::__construct() not being initalized instead of segfaulting. This happens from the CLI and through Apache using libphp5.so The backtrace I have included is from 5.2.2, but I have verified that it causes a segfault on 5.2.3 as well. ~ Eric Reproduce code: --------------- <?php class foo extends RecursiveIteratorIterator { private $_bar; public function __construct($str) { $this->_bar = $str; } public function bar() { return $this->_bar; } } $foo = new foo("This is bar"); echo $foo->bar(); ?> Expected result: ---------------- Output: This is bar Actual result: -------------- Segmentation Fault Backtrace: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 47957714823424 (LWP 9682)] 0x00000000005e7cbe in spl_recursive_it_get_method (object_ptr=0x7fffa7c67cb8, method=0xe09798 "bar", method_len=3, tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/ext/spl/spl_iterators.c:696 696 zval *zobj = object->iterators[level].zobject; (gdb) bt #0 0x00000000005e7cbe in spl_recursive_it_get_method ( object_ptr=0x7fffa7c67cb8, method=0xe09798 "bar", method_len=3, tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/ext/spl/spl_iterators.c:696 #1 0x000000000080feab in ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER ( execute_data=0x7fffa7c67c70, tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/Zend/zend_vm_execute.h:21218 #2 0x00000000007c07e1 in execute (op_array=0xe03090, tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/Zend/zend_vm_execute.h:92 #3 0x000000000078361c in zend_eval_string ( str=0x7fffa7c68871 "class foo extends RecursiveIteratorIterator { private $_bar; public function __construct($str) { $this->_bar = $str; } public function bar() { return $this->_bar; } } $foo = new foo(\"This is bar\"); $f"..., retval_ptr=0x0, string_name=0x91bee4 "Command line code", tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/Zend/zend_execute_API.c:1148 #4 0x0000000000783840 in zend_eval_string_ex ( str=0x7fffa7c68871 "class foo extends RecursiveIteratorIterator { private $_bar; public function __construct($str) { $this->_bar = $str; } public function bar() { return $this->_bar; } } $foo = new foo(\"This is bar\"); $f"..., retval_ptr=0x0, string_name=0x91bee4 "Command line code", handle_exceptions=1, tsrm_ls=0xbc0030) at /home/mirashii/php-sources/php-5.2.2/Zend/zend_execute_API.c:1182 #5 0x000000000082510e in main (argc=3, argv=0x7fffa7c68258)