php-src/ext/spl/tests/DirectoryIterator_by_reference.phpt

18 lines
429 B
Plaintext
Raw Normal View History

2009-08-26 17:17:58 +00:00
--TEST--
DirectoryIterator: test that you cannot use iterator with reference
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
--FILE--
<?php
2011-09-06 07:26:05 +00:00
$it = new DirectoryIterator(__DIR__);
2009-08-26 17:17:58 +00:00
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