1--TEST--
2Test closedir() function : usage variations - close directory handle twice
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 * close the directory handle twice using closedir() to test behaviour
13 */
14
15echo "*** Testing closedir() : usage variations ***\n";
16
17//create temporary directory for test, removed in CLEAN section
18$directory = __DIR__ . "/私はガラスを食べられますclosedir_variation2";
19mkdir($directory);
20
21$dh = opendir($directory);
22
23echo "\n-- Close directory handle first time: --\n";
24var_dump(closedir($dh));
25echo "Directory Handle: ";
26var_dump($dh);
27
28echo "\n-- Close directory handle second time: --\n";
29try {
30    var_dump(closedir($dh));
31} catch (TypeError $e) {
32    echo $e->getMessage(), "\n";
33}
34echo "Directory Handle: ";
35var_dump($dh);
36?>
37--CLEAN--
38<?php
39$directory = __DIR__ . "/私はガラスを食べられますclosedir_variation2";
40rmdir($directory);
41?>
42--EXPECTF--
43*** Testing closedir() : usage variations ***
44
45-- Close directory handle first time: --
46NULL
47Directory Handle: resource(%d) of type (Unknown)
48
49-- Close directory handle second time: --
50closedir(): %s is not a valid Directory resource
51Directory Handle: resource(%d) of type (Unknown)
52