1--TEST--
2Test rewinddir() function : usage variations - operate on a closed directory
3--FILE--
4<?php
5/* Prototype  : void rewinddir([resource $dir_handle])
6 * Description: Rewind dir_handle back to the start
7 * Source code: ext/standard/dir.c
8 * Alias to functions: rewind
9 */
10
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 = dirname(__FILE__) . '/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";
26var_dump(rewinddir($dir_handle));
27?>
28===DONE===
29--CLEAN--
30<?php
31$dir_path = dirname(__FILE__) . '/rewinddir_variation2';
32rmdir($dir_path);
33?>
34--EXPECTF--
35*** Testing rewinddir() : usage variations ***
36
37-- Create the directory handle, read and close the directory --
38resource(%d) of type (stream)
39string(%d) "%s"
40
41-- Call to rewinddir() --
42
43Warning: rewinddir(): supplied resource is not a valid Directory resource in %s on line %d
44bool(false)
45===DONE===
46