1--TEST--
2Test readdir() function : usage variations - operate on previously opened 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 two directory handles on the same directory and pass both
13 * to readdir() to test behaviour
14 */
15
16echo "*** Testing readdir() : usage variations ***\n";
17
18// include the file.inc for Function: function create_files()
19include( __DIR__."/../file/file.inc");
20
21// create the temporary directory
22$dir_path = __DIR__ . "/私はガラスを食べられますreaddir_variation6";
23mkdir($dir_path);
24
25// create files within the temporary directory
26create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますreaddir_variation6");
27
28// open the directory
29$dir_handle1 = opendir($dir_path);
30
31// open the same directory again without closing it
32opendir($dir_path);
33
34echo "\n-- Reading Directory Contents with Previous Handle --\n";
35$a = array();
36while (FALSE !== ($file = readdir($dir_handle1))) {
37    $a[] = $file;
38}
39sort($a);
40foreach ($a as $file) {
41    var_dump($file);
42}
43
44echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
45$a = array();
46while (FALSE !== ($file = readdir())) {
47    $a[] = $file;
48}
49sort($a);
50foreach ($a as $file) {
51    var_dump($file);
52}
53
54// delete temporary files
55delete_files($dir_path, 3, "私はガラスを食べられますreaddir_variation6");
56closedir($dir_handle1);
57closedir();
58?>
59--CLEAN--
60<?php
61$dir_path = __DIR__ . "/私はガラスを食べられますreaddir_variation6";
62rmdir($dir_path);
63?>
64--EXPECT--
65*** Testing readdir() : usage variations ***
66
67-- Reading Directory Contents with Previous Handle --
68string(1) "."
69string(2) ".."
70string(59) "私はガラスを食べられますreaddir_variation61.tmp"
71string(59) "私はガラスを食べられますreaddir_variation62.tmp"
72string(59) "私はガラスを食べられますreaddir_variation63.tmp"
73
74-- Reading Directory Contents with Current Handle (no arguments supplied) --
75string(1) "."
76string(2) ".."
77string(59) "私はガラスを食べられますreaddir_variation61.tmp"
78string(59) "私はガラスを食べられますreaddir_variation62.tmp"
79string(59) "私はガラスを食べられますreaddir_variation63.tmp"
80