From:             daan at react dot nl
Operating system: 
PHP version:      5.2.4
PHP Bug Type:     SPL related
Bug description:  Exception raised in an iterator::current() causes segfault in 
FilterIterator

Description:
------------
When raising an exception in the current() method of an iterator while
that iterator is being processed by either an IteratorIterator or
FilterIterator causes PHP to crash.

Reproduce code:
---------------
<?php
class BlaIterator implements Iterator
{
        public function rewind()
        {
        }

        public function next()
        {
        }

        public function valid()
        {
                return true;
        }

        public function current()
        {
                throw new Exception('boo');
        }

        public function key()
        {
        }
}

$it = new BlaIterator();
$itit = new IteratorIterator($it);

foreach ($itit as $key => $value)
        echo $value;

Expected result:
----------------
Exception thrown

Actual result:
--------------
#0  zim_spl_dual_it_rewind (ht=0, return_value=0xb7827e04,
return_value_ptr=0x0, this_ptr=0xb7826d80, return_value_used=1)
    at /usr/src/php-5.2.4/ext/spl/spl_iterators.c:1128
#1  0x08327528 in zend_call_function (fci=0xbfa93970,
fci_cache=0xbfa93950) at /usr/src/php-5.2.4/Zend/zend_execute_API.c:1004
#2  0x083447e0 in zend_call_method (object_pp=0xbfa939f0,
obj_ce=0x86c73d0, fn_proxy=0x86c7500, function_name=0x85c5425 "rewind",
function_name_len=6,
    retval_ptr_ptr=0x0, param_count=0, arg1=0x0, arg2=0x0) at
/usr/src/php-5.2.4/Zend/zend_interfaces.c:88
#3  0x08344ded in zend_user_it_rewind (_iter=0xb7829124) at
/usr/src/php-5.2.4/Zend/zend_interfaces.c:252
#4  0x0839af62 in ZEND_FE_RESET_SPEC_CV_HANDLER (execute_data=0xbfa93bb0)
at /usr/src/php-5.2.4/Zend/zend_vm_execute.h:19980
#5  0x0834f5b9 in execute (op_array=0xb782726c) at
/usr/src/php-5.2.4/Zend/zend_vm_execute.h:92
#6  0xb77cc44e in xdebug_execute (op_array=0xb782726c) at
/tmp/pear/cache/xdebug-2.0.0RC3/xdebug.c:1487
#7  0x083341c4 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/src/php-5.2.4/Zend/zend.c:1134
#8  0x082f822a in php_execute_script (primary_file=0xbfa96030) at
/usr/src/php-5.2.4/main/main.c:1982
#9  0x083b802f in main (argc=2, argv=0xbfa96104) at
/usr/src/php-5.2.4/sapi/cli/php_cli.c:1140


-- 
Edit bug report at http://bugs.php.net/?id=42703&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42703&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42703&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42703&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42703&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42703&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42703&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42703&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42703&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42703&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42703&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42703&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42703&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42703&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42703&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42703&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42703&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42703&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42703&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42703&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42703&r=mysqlcfg

Reply via email to