summaryrefslogtreecommitdiff
path: root/ext/spl/tests/DirectoryIterator_by_reference.phpt
blob: 3c5c5ac2b2a173f4d0944e6bed93da7fda5f0df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--TEST--
DirectoryIterator: test that you cannot use iterator with reference
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
--FILE--
<?php
$it = new DirectoryIterator(__DIR__); 
foreach( $it as &$file ) {
	echo $file . "\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