1--TEST--
2Test rewinddir() function : usage variations - operate on a closed directory
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6  die("skip Valid only on Windows");
7}
8?>
9--FILE--
10<?php
11/*
12 * Open and close a directory handle then call rewinddir() to test behaviour
13 */
14
15echo "*** Testing rewinddir() : usage variations ***\n";
16
17$dir_path = __DIR__ . '/私はガラスを食べられますrewinddir_variation2';
18mkdir($dir_path);
19
20echo "\n-- Create the directory handle, read and close the directory --\n";
21var_dump($dir_handle = opendir($dir_path));
22var_dump(readdir($dir_handle));
23closedir($dir_handle);
24
25echo "\n-- Call to rewinddir() --\n";
26try {
27    var_dump(rewinddir($dir_handle));
28} catch (TypeError $e) {
29    echo $e->getMessage(), "\n";
30}
31?>
32--CLEAN--
33<?php
34$dir_path = __DIR__ . '/私はガラスを食べられますrewinddir_variation2';
35rmdir($dir_path);
36?>
37--EXPECTF--
38*** Testing rewinddir() : usage variations ***
39
40-- Create the directory handle, read and close the directory --
41resource(%d) of type (stream)
42string(%d) "%s"
43
44-- Call to rewinddir() --
45rewinddir(): %s is not a valid Directory resource
46