From: sperson at lfdj dot com
Operating system:
PHP version: 5.1.4
PHP Bug Type: SPL related
Bug description: offsetUnset() on foreached arrayObject item throw E_NOTICE
Description:
------------
When we do a foreach on an arrayObject, and we want to unset some item
from the loop a NOTICE is thrown.
Don't know if this is the intended behaviour but in case of doubt I prefer
to submit.
Reproduce code:
---------------
$coll = new ArrayObject();
$coll->append(new stdClass());
foreach ($coll as $index => $item) {
$coll->offsetUnset($index);
}
Expected result:
----------------
nothing
Actual result:
--------------
Notice: main() [function.main]: ArrayIterator::next(): Array was modified
outside object and internal position is no longer valid in index.php on
line 7
--
Edit bug report at http://bugs.php.net/?id=37623&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37623&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=37623&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37623&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37623&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37623&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37623&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37623&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37623&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37623&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37623&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37623&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37623&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37623&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37623&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37623&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37623&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37623&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37623&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37623&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37623&r=mysqlcfg