1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/spl/tests/bug51119.phpt
2020-09-15 12:49:59 +02:00

26 lines
495 B
PHP

--TEST--
SPL: LimitIterator zero is valid offset
--FILE--
<?php
$array = array('a', 'b', 'c');
$arrayIterator = new ArrayIterator($array);
$limitIterator = new LimitIterator($arrayIterator, 0);
foreach ($limitIterator as $item) {
echo $item . "\n";
}
try {
$limitIterator = new LimitIterator($arrayIterator, -1);
} catch (\ValueError $e){
print $e->getMessage() . "\n";
}
?>
--EXPECT--
a
b
c
LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0