mirror of
https://github.com/php/php-src.git
synced 2025-01-26 05:34:32 +08:00
a555cc0b3d
Remove most of the `===DONE===` tags and its variations. Keep `===DONE===` if the test output otherwise becomes empty. Closes GH-4872.
33 lines
588 B
PHP
33 lines
588 B
PHP
--TEST--
|
|
SPL: LimitIterator zero is valid offset
|
|
--FILE--
|
|
<?php
|
|
|
|
$array = array('a', 'b', 'c');
|
|
$arrayIterator = new ArrayIterator($array);
|
|
|
|
try {
|
|
$limitIterator = new LimitIterator($arrayIterator, 0);
|
|
foreach ($limitIterator as $item) {
|
|
echo $item . "\n";
|
|
}
|
|
} catch (OutOfRangeException $e){
|
|
print $e->getMessage() . "\n";
|
|
}
|
|
|
|
try {
|
|
$limitIterator = new LimitIterator($arrayIterator, -1);
|
|
foreach ($limitIterator as $item) {
|
|
echo $item . "\n";
|
|
}
|
|
} catch (OutOfRangeException $e){
|
|
print $e->getMessage() . "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
a
|
|
b
|
|
c
|
|
Parameter offset must be >= 0
|