From: eric dot gach at gmail dot com
Operating system: Any
PHP version: 5.2.3
PHP Bug Type: Reproducible crash
Bug description: Failing to call RecursiveIteratorIterator::__construct() causes a sefault
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)
--
Edit bug report at http://bugs.php.net/?id=41828&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41828&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41828&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41828&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41828&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41828&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41828&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41828&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41828&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41828&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41828&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41828&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41828&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41828&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41828&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41828&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41828&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41828&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41828&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41828&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41828&r=mysqlcfg