readdir_variation7.phpt 552 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Test readdir() function : usage variations - use file pointers
  3. --FILE--
  4. <?php
  5. /*
  6. * Open a file pointer using fopen and pass to readdir() to test behaviour
  7. */
  8. echo "*** Testing readdir() : usage variations ***\n";
  9. // get a resource variable
  10. var_dump($fp = fopen(__FILE__, "r"));
  11. try {
  12. var_dump( readdir($fp) );
  13. } catch (\TypeError $e) {
  14. echo $e->getMessage() . "\n";
  15. }
  16. ?>
  17. --EXPECTF--
  18. *** Testing readdir() : usage variations ***
  19. resource(%d) of type (stream)
  20. readdir(): Argument #1 ($dir_handle) must be a valid Directory resource