From: kase at gmx dot net
Operating system: linux
PHP version: 5CVS-2004-02-29 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Segfault in CVS
Description:
------------
I get a segfault with this script:
Reproduce code:
---------------
<?php
class test {
public function start() {
foreach ( $this->array as $foo ) {
$foo->any_method();
}
}
}
$test = new test();
$test->start();
?>
Expected result:
----------------
If $this->array is an array with objects, the method any_method() should
be called on $foo. (works well)
If $this->array is an array with strings, int, ..., php should display an
error. (works well) (Fatal error: Call to a member function any_method()
on a non-object in /var/www/legendz/web/test/test.php5 on line 5 )
If $this->array is an empty array, nothing should happen. (but php
crashes)
Actual result:
--------------
(gdb) bt
#0 0x082128b4 in zend_fetch_obj_w_handler (execute_data=0xbfffd840,
opline=0x404e9518, op_array=0x404dd7d4)
at /home/kase/php5-200402271430/Zend/zend_execute.c:2044
#1 0x08210be0 in execute (op_array=0x404dd7d4)
at /home/kase/php5-200402271430/Zend/zend_execute.c:1339
#2 0x082143c9 in zend_do_fcall_common_helper (execute_data=0xbfffd9f0,
opline=0x404e84dc, op_array=0x404dd018)
at /home/kase/php5-200402271430/Zend/zend_execute.c:2675
#3 0x082147f6 in zend_do_fcall_by_name_handler (execute_data=0xbfffd9f0,
opline=0x404e84dc, op_array=0x404dd018)
at /home/kase/php5-200402271430/Zend/zend_execute.c:2757
#4 0x08210be0 in execute (op_array=0x404dd018)
at /home/kase/php5-200402271430/Zend/zend_execute.c:1339
#5 0x081f0289 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/kase/php5-200402271430/Zend/zend.c:1041
#6 0x081b0a13 in php_execute_script (primary_file=0xbffffd48)
at /home/kase/php5-200402271430/main/main.c:1650
#7 0x0821d16c in main (argc=2, argv=0xbffffde4)
at /home/kase/php5-200402271430/sapi/cgi/cgi_main.c:1573
--
Edit bug report at http://bugs.php.net/?id=27439&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27439&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27439&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27439&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27439&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27439&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27439&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27439&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27439&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27439&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27439&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27439&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27439&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27439&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27439&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27439&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27439&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27439&r=float