bug70561.phpt 438 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException)
  3. --FILE--
  4. <?php
  5. $di = new DirectoryIterator(__DIR__ . '/..');
  6. $cnt = 0;
  7. $di->rewind();
  8. while ($di->valid()) {
  9. $cnt++;
  10. $di->next();
  11. }
  12. try {
  13. $di->seek($cnt+1);
  14. } catch (OutOfBoundsException $ex) {
  15. echo $ex->getMessage() . PHP_EOL;
  16. }
  17. echo "Is valid? " . (int) $di->valid() . PHP_EOL;
  18. ?>
  19. --EXPECTF--
  20. Seek position %d is out of range
  21. Is valid? 0