1--TEST-- 2Bug #75173 incorrect behavior of AppendIterator::append in foreach loop 3--FILE-- 4<?php 5 6$it = new \AppendIterator(); 7$it->append(new ArrayIterator(['foo'])); 8 9foreach ($it as $item) { 10 var_dump($item); 11 12 if ('foo' === $item) { 13 $it->append(new ArrayIterator(['bar'])); 14 } 15} 16?> 17--EXPECT-- 18string(3) "foo" 19string(3) "bar" 20