Bug #79404 [Opn]: Referencing to SplFixedArray interrupts foreach loop

From: Date: Sun, 22 Mar 2020 23:32:58 +0000
Subject: Bug #79404 [Opn]: Referencing to SplFixedArray interrupts foreach loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226229@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:             Open
 Type:               Bug
 Package:            SPL related
 Operating System:   all
 PHP Version:        5.4.0 - 7.4.4
 Block user comment: N
 Private report:     N

 New Comment:

Presuming for Iterators

    foreach ($it as $el) {
        var_dump($el);
    }

is equivalent to

    for ($it->rewind(); $it->valid(); $it->next()) {
        $el = $it->current();
        var_dump($el);
    }

the behavior is correct.  On the other hand, SplDoublyLinkedList,
for instance, supports nested traversal via foreach ...


Previous Comments:
------------------------------------------------------------------------
[2020-03-22 15:50:30] vlad dot turchinskiy at yandex dot ru

Description:
------------
Referencing to SplFixedArray interrupts foreach loop.

Test script:
---------------
https://3v4l.org/FdN4i

Expected result:
----------------
3 iterations executed.

Actual result:
--------------
1 iteration executed.

------------------------------------------------------------------------
[2020-03-22 15:40:32] vlad dot turchinskiy at yandex dot ru

Description:
------------
Referencing to SplFixedArray interrupts foreach loop.

Test script:
---------------
https://3v4l.org/FdN4i

Expected result:
----------------
3 iterations executed.

Actual result:
--------------
1 iteration executed.

------------------------------------------------------------------------
[2020-03-22 15:37:45] vlad dot turchinskiy at yandex dot ru

Description:
------------
Referencing to SplFixedArray interrupts foreach loop.

Test script:
---------------
https://3v4l.org/FdN4i

Expected result:
----------------
3 iterations executed.

Actual result:
--------------
1 iteration executed.

------------------------------------------------------------------------
[2020-03-22 14:44:32] vlad dot turchinskiy at yandex dot ru

Description:
------------
Referencing to SplFixedArray interrupts foreach loop.

Test script:
---------------
https://3v4l.org/FdN4i

Expected result:
----------------
3 iterations executed.

Actual result:
--------------
1 iteration executed.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79404&edit=1


Thread (1 message)

  • cmb@php.net
  • Unknown Message
    • cmb@php.net
« previous php.bugs (#226229) next »