summaryrefslogtreecommitdiff
path: root/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt
blob: 9fead1e4550770fa504ef3c4e96108020696215f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
--TEST--
Test scandir() function : usage variations - different file names
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
  die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
 * Description: List files & directories inside the specified path
 * Source code: ext/standard/dir.c
 */

/*
 * Pass a directory containing files with different types of names to test how scandir()
 * reads them
 */

echo "*** Testing scandir() : usage variations ***\n";

$dir_path = dirname(__FILE__) . "/私はガラスを食べられますscandir_variation8/";
mkdir($dir_path);

// heredoc string
$heredoc = <<<EOT
hd_file
EOT;

$inputs = array(

       // int data
/*1*/  0,
       1,
       12345,
       -2345,

       // float data
/*5*/  10.5,
       -10.5,
       12.3456789000e10,
       12.3456789000E-10,
       .5,

       // empty data
/*10*/ "",
       array(),

       // string data
/*12*/ "double_file",
       'single_file',
       $heredoc,
);

$iterator = 1;
foreach($inputs as $key => $input) {
	echo "\n-- Iteration $iterator --\n";
	$handle = "fp{$iterator}";
	var_dump( $$handle = @fopen($dir_path . "/私はガラスを食べられます$input.tmp", 'w') );
	fclose($$handle);
	$iterator++;
};

echo "\n-- Call to scandir() --\n";
var_dump($content = scandir($dir_path));

// remove all files in directory so can remove directory in CLEAN section
foreach ($content as $file_name) {
	// suppress errors as won't be able to remove "." and ".." entries
	@unlink($dir_path . $file_name);
}
?>
===DONE===
--CLEAN--
<?php
$dir_path = dirname(__FILE__) . "/私はガラスを食べられますscandir_variation8";
rmdir($dir_path);
?>
--EXPECTF--
*** Testing scandir() : usage variations ***

-- Iteration 1 --
resource(%d) of type (stream)

-- Iteration 2 --
resource(%d) of type (stream)

-- Iteration 3 --
resource(%d) of type (stream)

-- Iteration 4 --
resource(%d) of type (stream)

-- Iteration 5 --
resource(%d) of type (stream)

-- Iteration 6 --
resource(%d) of type (stream)

-- Iteration 7 --
resource(%d) of type (stream)

-- Iteration 8 --
resource(%d) of type (stream)

-- Iteration 9 --
resource(%d) of type (stream)

-- Iteration 10 --
resource(%d) of type (stream)

-- Iteration 11 --
resource(%d) of type (stream)

-- Iteration 12 --
resource(%d) of type (stream)

-- Iteration 13 --
resource(%d) of type (stream)

-- Iteration 14 --
resource(%d) of type (stream)

-- Call to scandir() --
array(16) {
  [0]=>
  string(1) "."
  [1]=>
  string(2) ".."
  [2]=>
  string(45) "私はガラスを食べられます-10.5.tmp"
  [3]=>
  string(45) "私はガラスを食べられます-2345.tmp"
  [4]=>
  string(40) "私はガラスを食べられます.tmp"
  [5]=>
  string(43) "私はガラスを食べられます0.5.tmp"
  [6]=>
  string(41) "私はガラスを食べられます0.tmp"
  [7]=>
  string(53) "私はガラスを食べられます1.23456789E-9.tmp"
  [8]=>
  string(41) "私はガラスを食べられます1.tmp"
  [9]=>
  string(44) "私はガラスを食べられます10.5.tmp"
  [10]=>
  string(45) "私はガラスを食べられます12345.tmp"
  [11]=>
  string(52) "私はガラスを食べられます123456789000.tmp"
  [12]=>
  string(45) "私はガラスを食べられますArray.tmp"
  [13]=>
  string(51) "私はガラスを食べられますdouble_file.tmp"
  [14]=>
  string(47) "私はガラスを食べられますhd_file.tmp"
  [15]=>
  string(51) "私はガラスを食べられますsingle_file.tmp"
}
===DONE===