xref: /PHP-7.2/ext/spl/tests/iterator_069.phpt (revision 17ccbeec)
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