summaryrefslogtreecommitdiff
path: root/ext/spl/tests/iterator_069.phpt
blob: 975fbe2f8e1943dccd08159c450987893d678738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--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 RuntimeException: An iterator cannot be used with foreach by reference in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d