1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00
Files
archived-php-src/ext/spl/tests/iterator_069.phpt

21 lines
473 B
PHP

--TEST--
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
--FILE--
<?php
$arr = array(array(1,2));
$arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
$recItIt = new RecursiveIteratorIterator($recArrIt);
foreach ($recItIt as &$val) echo "$val\n";
?>
--EXPECTF--
Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d