Bug #75173 [NEW]: AppendIterator: Changes within foreach ignored
| From: | gharlan at web dot de | Date: | Fri, 08 Sep 2017 10:30:05 +0000 |
| Subject: | Bug #75173 [NEW]: AppendIterator: Changes within foreach ignored | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211005@lists.php.net to get a copy of this message | ||
From: gharlan at web dot de
Operating system:
PHP version: 7.1.9
Package: SPL related
Bug Type: Bug
Bug description:AppendIterator: Changes within foreach ignored
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 bug report at https://bugs.php.net/bug.php?id=75173&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75173&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75173&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75173&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75173&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75173&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75173&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75173&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75173&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75173&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75173&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75173&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75173&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75173&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75173&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75173&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75173&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75173&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75173&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75173&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75173&r=mysqlcfg