Bug #65629 [Asn->Ver]: SplObjectsStorage::detach() rewinds internal pointer
Edit report at https://bugs.php.net/bug.php?id=65629&edit=1
ID: 65629
Updated by: levim@php.net
Reported by: alan dot bem at gmail dot com
Summary: SplObjectsStorage::detach() rewinds internal pointer
-Status: Assigned
+Status: Verified
Type: Bug
Package: SPL related
PHP Version: Irrelevant
-Assigned To: levim
+Assigned To:
Block user comment: N
Private report: N
New Comment:
I was unable to fix this with the time I allotted. Un-assigning.
Previous Comments:
------------------------------------------------------------------------
[2021-10-05 15:57:02] artter178 at gmail dot com
Dear php team, can you fix this behaviour?
------------------------------------------------------------------------
[2018-08-19 16:49:10] cmb@php.net
> It's behaviour should be more similar to ArrayObject, it's less
> confusing that way.
Is it less confusing? Consider:
<?php
$items = new ArrayObject(range(1, 10));
foreach ($items as $key => $val) {
unset($items[$key]);
}
print_r($items->getArrayCopy());
prints:
Array
(
[1] => 2
[3] => 4
[5] => 6
[7] => 8
[9] => 10
)
------------------------------------------------------------------------
[2015-07-20 10:08:56] bas at dmt-software dot nl
SplObjectsStorage::attach() does change the pointer too.
These operations should not change the internal pointer at all.
It's behaviour should be more similar to ArrayObject, it's less confusing that way.
------------------------------------------------------------------------
[2013-09-21 23:02:47] levim@php.net
Bug #63917 is a duplicate of this one (has a phpt uploaded -- might be useful).
------------------------------------------------------------------------
[2013-09-21 22:58:59] levim@php.net
Related To: Bug #63917
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=65629
--
Edit this bug report at https://bugs.php.net/bug.php?id=65629&edit=1
Thread (7 messages)