1--TEST-- 2SPL: IteratorIterator foreach by reference failure 3--CREDITS-- 4Lukasz Andrzejak meltir@meltir.com 5#testfest London 2009-05-09 6--FILE-- 7<?php 8$i = new ArrayIterator(array(1,1,1,1,1)); 9$iii = new IteratorIterator($i); 10p($iii); 11function p ($i) { 12 foreach ($i as &$value) {} 13} 14?> 15--EXPECTF-- 16Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d 17Stack trace: 18#0 %s(%d): p(Object(IteratorIterator)) 19#1 {main} 20 thrown in %s on line %d 21