1--TEST--
2Test scandir() function : usage variations - different file names
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/* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
12 * Description: List files & directories inside the specified path
13 * Source code: ext/standard/dir.c
14 */
15
16/*
17 * Pass a directory containing files with different types of names to test how scandir()
18 * reads them
19 */
20
21echo "*** Testing scandir() : usage variations ***\n";
22
23$dir_path = __DIR__ . "/私はガラスを食べられますscandir_variation8/";
24mkdir($dir_path);
25
26// heredoc string
27$heredoc = <<<EOT
28hd_file
29EOT;
30
31$inputs = array(
32
33       // int data
34/*1*/  0,
35       1,
36       12345,
37       -2345,
38
39       // float data
40/*5*/  10.5,
41       -10.5,
42       12.3456789000e10,
43       12.3456789000E-10,
44       .5,
45
46       // empty data
47/*10*/ "",
48       array(),
49
50       // string data
51/*12*/ "double_file",
52       'single_file',
53       $heredoc,
54);
55
56$iterator = 1;
57foreach($inputs as $key => $input) {
58	echo "\n-- Iteration $iterator --\n";
59	$handle = "fp{$iterator}";
60	var_dump( $$handle = @fopen($dir_path . "/私はガラスを食べられます$input.tmp", 'w') );
61	fclose($$handle);
62	$iterator++;
63};
64
65echo "\n-- Call to scandir() --\n";
66var_dump($content = scandir($dir_path));
67
68// remove all files in directory so can remove directory in CLEAN section
69foreach ($content as $file_name) {
70	// suppress errors as won't be able to remove "." and ".." entries
71	@unlink($dir_path . $file_name);
72}
73?>
74===DONE===
75--CLEAN--
76<?php
77$dir_path = __DIR__ . "/私はガラスを食べられますscandir_variation8";
78rmdir($dir_path);
79?>
80--EXPECTF--
81*** Testing scandir() : usage variations ***
82
83-- Iteration 1 --
84resource(%d) of type (stream)
85
86-- Iteration 2 --
87resource(%d) of type (stream)
88
89-- Iteration 3 --
90resource(%d) of type (stream)
91
92-- Iteration 4 --
93resource(%d) of type (stream)
94
95-- Iteration 5 --
96resource(%d) of type (stream)
97
98-- Iteration 6 --
99resource(%d) of type (stream)
100
101-- Iteration 7 --
102resource(%d) of type (stream)
103
104-- Iteration 8 --
105resource(%d) of type (stream)
106
107-- Iteration 9 --
108resource(%d) of type (stream)
109
110-- Iteration 10 --
111resource(%d) of type (stream)
112
113-- Iteration 11 --
114resource(%d) of type (stream)
115
116-- Iteration 12 --
117resource(%d) of type (stream)
118
119-- Iteration 13 --
120resource(%d) of type (stream)
121
122-- Iteration 14 --
123resource(%d) of type (stream)
124
125-- Call to scandir() --
126array(16) {
127  [0]=>
128  string(1) "."
129  [1]=>
130  string(2) ".."
131  [2]=>
132  string(45) "私はガラスを食べられます-10.5.tmp"
133  [3]=>
134  string(45) "私はガラスを食べられます-2345.tmp"
135  [4]=>
136  string(40) "私はガラスを食べられます.tmp"
137  [5]=>
138  string(43) "私はガラスを食べられます0.5.tmp"
139  [6]=>
140  string(41) "私はガラスを食べられます0.tmp"
141  [7]=>
142  string(53) "私はガラスを食べられます1.23456789E-9.tmp"
143  [8]=>
144  string(41) "私はガラスを食べられます1.tmp"
145  [9]=>
146  string(44) "私はガラスを食べられます10.5.tmp"
147  [10]=>
148  string(45) "私はガラスを食べられます12345.tmp"
149  [11]=>
150  string(52) "私はガラスを食べられます123456789000.tmp"
151  [12]=>
152  string(45) "私はガラスを食べられますArray.tmp"
153  [13]=>
154  string(51) "私はガラスを食べられますdouble_file.tmp"
155  [14]=>
156  string(47) "私はガラスを食べられますhd_file.tmp"
157  [15]=>
158  string(51) "私はガラスを食べられますsingle_file.tmp"
159}
160===DONE===
161