1--TEST--
2Test rewinddir() function : usage variations - operate on a closed directory
3--FILE--
4<?php
5/*
6 * Open and close a directory handle then call rewinddir() to test behaviour
7 */
8
9echo "*** Testing rewinddir() : usage variations ***\n";
10
11$dir_path = __DIR__ . '/rewinddir_variation2';
12mkdir($dir_path);
13
14echo "\n-- Create the directory handle, read and close the directory --\n";
15var_dump($dir_handle = opendir($dir_path));
16var_dump(readdir($dir_handle));
17closedir($dir_handle);
18
19echo "\n-- Call to rewinddir() --\n";
20try {
21    var_dump(rewinddir($dir_handle));
22} catch (TypeError $e) {
23    echo $e->getMessage(), "\n";
24}
25?>
26--CLEAN--
27<?php
28$dir_path = __DIR__ . '/rewinddir_variation2';
29rmdir($dir_path);
30?>
31--EXPECTF--
32*** Testing rewinddir() : usage variations ***
33
34-- Create the directory handle, read and close the directory --
35resource(%d) of type (stream)
36string(%d) "%s"
37
38-- Call to rewinddir() --
39rewinddir(): supplied resource is not a valid Directory resource
40