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

21 lines
424 B
PHP

--TEST--
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
--FILE--
<?php
$recArrIt = new RecursiveArrayIterator([
[1, 2],
['a', 'b'],
]);
$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