summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug70561.phpt
blob: c6c229ad89d0df478f801ad1b6bab1ddb26a1138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException)
--FILE--
<?php
$di = new DirectoryIterator(__DIR__ . '/..');

$cnt = 0;
$di->rewind();
while ($di->valid()) {
    $cnt++;
    $di->next();
}

try {
    $di->seek($cnt+1);
} catch (OutOfBoundsException $ex) {
    echo $ex->getMessage() . PHP_EOL;
}
echo "Is valid? " . (int) $di->valid() . PHP_EOL;
?>
--EXPECTF--
Seek position %d is out of range
Is valid? 0