|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75173 incorrect behavior of AppendIterator::append in foreach loop
Submitted: 2017-09-08 10:30 UTC Modified: 2017-09-10 18:11 UTC
From: gharlan at web dot de Assigned: jhdxr (profile)
Status: Closed Package: SPL related
PHP Version: 7.0.23 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
24 - 3 = ?
Subscribe to this entry?

 [2017-09-08 10:30 UTC] gharlan at web dot de

I guess the change was introduced by

Test script:

$it = new \AppendIterator();
$it->append(new ArrayIterator(['foo']));

foreach ($it as $item) {
    echo $item;
    if ('foo' === $item) {
        $it->append(new ArrayIterator(['bar']));

Expected result:

Actual result:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-08 18:14 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: jhdxr
 [2017-09-10 18:11 UTC]
-Summary: AppendIterator: Changes within foreach ignored +Summary: incorrect behavior of AppendIterator::append in foreach loop -Status: Verified +Status: Assigned -PHP Version: 7.1.9 +PHP Version: 7.0.23
 [2017-09-12 06:08 UTC]
Automatic comment on behalf of jhdxr
Log: fix bug #75173 incorrect behavior of AppendIterator::append in foreach loop
 [2017-09-12 06:08 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 20 08:03:35 2021 UTC