From:             tony2001 at phpclub dot net
Operating system: Linux 2.6.9
PHP version:      5CVS-2004-12-30 (dev)
PHP Bug Type:     SPL related
Bug description:  ArrayIterator::next segfaults

Description:
------------
ArrayIterator::next() segfaults when called after
ArrayIterator::offsetUnset().


Reproduce code:
---------------
<?php
$obj = new stdClass;
$obj->var1=1;

$ao = new ArrayObject($obj);

$i = $ao->getIterator();

$ao->offsetUnset($i->key());
$i->next();
echo "Done";
?>

Expected result:
----------------
Done

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x0818148b in zend_hash_get_current_key_ex (ht=0x82e44ac,
str_index=0xbfffd1c4, str_length=0xbfffd1c0,
    num_index=0xbfffd1bc, duplicate=0 '\0', pos=0x82e919c) at
/home/dev/php-src/Zend/zend_hash.c:1055
1055                    if (p->nKeyLength) {
(gdb) bt
#0  0x0818148b in zend_hash_get_current_key_ex (ht=0x82e44ac,
str_index=0xbfffd1c4, str_length=0xbfffd1c0,
    num_index=0xbfffd1bc, duplicate=0 '\0', pos=0x82e919c) at
/home/dev/php-src/Zend/zend_hash.c:1055
#1  0x080aff15 in spl_array_skip_protected (intern=0x82e918c) at
/home/dev/php-src/ext/spl/spl_array.c:479
#2  0x080b000b in spl_array_next (intern=0x82e918c) at
/home/dev/php-src/ext/spl/spl_array.c:502
#3  0x080b0d8e in zif_spl_Array_next (ht=0, return_value=0x82e9054,
this_ptr=0x82e90f4, return_value_used=0)
    at /home/dev/php-src/ext/spl/spl_array.c:857
#4  0x0819c493 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffd430) at zend_vm_execute.h:155
#5  0x0819ca01 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0xbfffd430) at zend_vm_execute.h:268
#6  0x0819c1ab in execute (op_array=0x82e43ec) at zend_vm_execute.h:58
#7  0x081793b7 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/dev/php-src/Zend/zend.c:1062
#8  0x08139647 in php_execute_script (primary_file=0xbffff840) at
/home/dev/php-src/main/main.c:1639
#9  0x081e92b5 in main (argc=2, argv=0xbffff8d4) at
/home/dev/php-src/sapi/cli/php_cli.c:944
#10 0x420157a4 in __libc_start_main () from /lib/tls/libc.so.6

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

Reply via email to