From:             guth at fiifo dot u-psud dot fr
Operating system: Linux
PHP version:      5.0.3
PHP Bug Type:     SPL related
Bug description:  offsetUnset() segfaults in a foreach

Description:
------------
Look at the following code :)

Reproduce code:
---------------
<?php

$object = new ArrayIterator;
$object->append(new stdClass);

foreach($object as $key => $value) {
        $object->offsetUnset($key);
}

exit((string)mt_rand(0, 1000));

?>

Expected result:
----------------
No crash.

Actual result:
--------------
#0  0x404195df in zend_hash_get_current_key_type_ex (ht=0x817a6ec,
pos=0x815556c)
    at /usr/src/php5-STABLE-200502101130/Zend/zend_hash.c:1083
#1  0x402ffe1b in spl_array_next (intern=0x815555c) at
/usr/src/php5-STABLE-200502101130/ext/spl/spl_array.c:498
#2  0x403001b7 in spl_array_it_move_forward (iter=0x817f6ec) at
/usr/src/php5-STABLE-200502101130/ext/spl/spl_array.c:586
#3  0x4043d6e0 in zend_fe_fetch_handler (execute_data=0xbfffcc10,
opline=0x817ef44, op_array=0x817a57c)
    at /usr/src/php5-STABLE-200502101130/Zend/zend_execute.c:3847
#4  0x40435156 in execute (op_array=0x817a57c) at
/usr/src/php5-STABLE-200502101130/Zend/zend_execute.c:1406
#5  0x404113c0 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/src/php5-STABLE-200502101130/Zend/zend.c:1068
#6  0x403d0c7e in php_execute_script (primary_file=0xbfffef80) at
/usr/src/php5-STABLE-200502101130/main/main.c:1630
#7  0x4043ec7e in apache_php_module_main (r=0x817100c,
display_source_mode=0)
    at /usr/src/php5-STABLE-200502101130/sapi/apache/sapi_apache.c:54
#8  0x4043f901 in send_php (r=0x817100c, display_source_mode=0,
filename=0x8171b14 "/anticorps/www/test.php")
    at /usr/src/php5-STABLE-200502101130/sapi/apache/mod_php5.c:622
#9  0x4043f968 in send_parsed_php (r=0x817100c) at
/usr/src/php5-STABLE-200502101130/sapi/apache/mod_php5.c:637
#10 0x08071e88 in ap_invoke_handler ()
#11 0x08086f10 in process_request_internal ()
#12 0x08086f6f in ap_process_request ()
#13 0x0807df91 in child_main ()
#14 0x0807e19c in make_child ()
#15 0x0807e300 in startup_children ()
#16 0x0807e9bf in standalone_main ()
#17 0x0807f1d7 in main ()

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

Reply via email to