Bug #79404 [Ver->Csd]: Referencing to SplFixedArray interrupts foreach loop
| From: | cmb@php.net | Date: | Fri, 08 Jan 2021 15:17:48 +0000 |
| Subject: | Bug #79404 [Ver->Csd]: Referencing to SplFixedArray interrupts foreach loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231451@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79404&edit=1
ID: 79404
Updated by: cmb@php.net
Reported by: vlad dot turchinskiy at yandex dot ru
Summary: Referencing to SplFixedArray interrupts foreach loop
-Status: Verified
+Status: Closed
Type: Bug
Package: SPL related
Operating System: all
PHP Version: 5.4.0 - 7.4.4
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The fix for this issue has been committed[1], and will be
available as of PHP 8.1.0 for BC reasons.
[1] <https://github.com/php/php-src/commit/4222ae16e7848e0b3f062a9a989d387de307a7af>
Previous Comments:
------------------------------------------------------------------------
[2020-04-14 09:06:44] alexinbeijing at gmail dot com
The following pull request has been associated:
Patch Name: SplFixedArray can be used in nested 'foreach' loops
On GitHub: https://github.com/php/php-src/pull/5384
Patch: https://github.com/php/php-src/pull/5384.patch
------------------------------------------------------------------------
[2020-04-14 08:19:25] alexinbeijing at gmail dot com
I have a patch which "fixes" get_iterator() without converting SplFixedArray to an
IteratorAggregate. It's a pretty dubious idea. Still, I may push it to GH for review and
comments.
------------------------------------------------------------------------
[2020-04-10 14:31:39] requinix@php.net
> Nikita, I don't understand how SplFixedArray could possibly support multiple
> parallel get_iterator()s while still following the contract of the Iterator
> interface. Could you explain what you mean?
To make sure that all the Traversables returned by multiple calls to getIterator() won't
conflict with each other.
------------------------------------------------------------------------
[2020-04-10 08:41:30] alexinbeijing at gmail dot com
> I do think we should ensure that multiple parallel get_iterator()s are supported independently
> of that.
Nikita, I don't understand how SplFixedArray could possibly support multiple parallel
get_iterator()s while still following the contract of the Iterator interface. Could you explain what
you mean?
------------------------------------------------------------------------
[2020-03-23 14:04:26] nikic@php.net
SplFixedArray should probably be IteratorAggregate rather than Iterator...
I do think we should ensure that multiple parallel get_iterator()s are supported independently of
that.
------------------------------------------------------------------------
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=79404
--
Edit this bug report at https://bugs.php.net/bug.php?id=79404&edit=1