1--TEST-- 2SPL: RecursiveIteratorIterator cannot be used with foreach by reference 3--FILE-- 4<?php 5 6$arr = array(array(1,2)); 7$arrOb = new ArrayObject($arr); 8 9$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); 10 11$recItIt = new RecursiveIteratorIterator($recArrIt); 12 13foreach ($recItIt as &$val) echo "$val\n"; 14 15?> 16--EXPECTF-- 17Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d 18Stack trace: 19#0 {main} 20 thrown in %s on line %d 21