xref: /PHP-7.1/ext/spl/tests/iterator_069.phpt (revision 7af945e2)
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: An iterator cannot be used with foreach by reference in %s on line %d
18