Bug #75173 [Opn->Ver]: AppendIterator: Changes within foreach ignored

From: Date: Fri, 08 Sep 2017 18:14:12 +0000
Subject: Bug #75173 [Opn->Ver]: AppendIterator: Changes within foreach ignored
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211011@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75173&edit=1 ID: 75173 Updated by: jhdxr@php.net Reported by: gharlan at web dot de Summary: AppendIterator: Changes within foreach ignored -Status: Open +Status: Verified Type: Bug Package: SPL related PHP Version: 7.1.9 -Assigned To: +Assigned To: jhdxr Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2017-09-08 10:30:03] gharlan at web dot de Description: ------------ https://3v4l.org/itLi1 I guess the change was introduced by https://github.com/php/php-src/pull/2499 Test script: --------------- <?php $it = new \AppendIterator(); $it->append(new ArrayIterator(['foo'])); foreach ($it as $item) { echo $item; if ('foo' === $item) { $it->append(new ArrayIterator(['bar'])); } } Expected result: ---------------- foobar Actual result: -------------- foo ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75173&edit=1

« previous php.bugs (#211011) next »