#37623 [Opn->Asn]: offsetUnset() on foreached arrayObject item throw E_NOTICE
| From: | tony2001@php.net | Date: | Mon, 29 May 2006 09:30:36 +0000 |
| Subject: | #37623 [Opn->Asn]: offsetUnset() on foreached arrayObject item throw E_NOTICE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97727@lists.php.net to get a copy of this message | ||
ID: 37623
Updated by: tony2001@php.net
Reported By: sperson at lfdj dot com
-Status: Open
+Status: Assigned
Bug Type: SPL related
PHP Version: 5.1.4
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2006-05-29 09:27:32] sperson at lfdj dot com
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 this bug report at http://bugs.php.net/?id=37623&edit=1