1--TEST--
2Test lstat() and stat() functions: usage variations - dir/file names in array
3--FILE--
4<?php
5/* test for stats of dir/file when their names are stored in an array */
6
7$file_path = __DIR__;
8require "$file_path/file.inc";
9
10
11/* create temp file, link and directory */
12@rmdir("$file_path/lstat_stat_variation19");  // ensure that dir doesn't exists
13mkdir("$file_path/lstat_stat_variation19");  // temp dir
14
15$fp = fopen("$file_path/lstat_stat_variation19.tmp", "w");  // temp file
16fclose($fp);
17
18echo "*** Testing stat() with filename & directory name stored inside an array ***\n";
19
20// array with default numeric index
21$names = array(
22  "$file_path/lstat_stat_variation19.tmp",
23  "$file_path/lstat_stat_variation19"
24);
25
26//array with string key index
27$names_with_key = array (
28  'file' => "$file_path/lstat_stat_variation19.tmp",
29  "dir" => "$file_path/lstat_stat_variation19"
30);
31
32echo "\n-- Testing stat() on filename stored inside an array --\n";
33var_dump( stat($names[0]) ); // values stored with numeric index
34var_dump( stat($names_with_key['file']) ); // value stored with string key
35
36echo "\n-- Testing stat() on dir name stored inside an array --\n";
37var_dump( stat($names[1]) ); // values stored with numeric index
38var_dump( stat($names_with_key["dir"]) ); // value stored with string key
39
40echo "\n--- Done ---";
41?>
42--CLEAN--
43<?php
44$file_path = __DIR__;
45unlink("$file_path/lstat_stat_variation19.tmp");
46rmdir("$file_path/lstat_stat_variation19");
47?>
48--EXPECTF--
49*** Testing stat() with filename & directory name stored inside an array ***
50
51-- Testing stat() on filename stored inside an array --
52array(26) {
53  [0]=>
54  int(%i)
55  [1]=>
56  int(%d)
57  [2]=>
58  int(%d)
59  [3]=>
60  int(%d)
61  [4]=>
62  int(%d)
63  [5]=>
64  int(%d)
65  [6]=>
66  int(%d)
67  [7]=>
68  int(%d)
69  [8]=>
70  int(%d)
71  [9]=>
72  int(%d)
73  [10]=>
74  int(%d)
75  [11]=>
76  int(%i)
77  [12]=>
78  int(%i)
79  ["dev"]=>
80  int(%i)
81  ["ino"]=>
82  int(%d)
83  ["mode"]=>
84  int(%d)
85  ["nlink"]=>
86  int(%d)
87  ["uid"]=>
88  int(%d)
89  ["gid"]=>
90  int(%d)
91  ["rdev"]=>
92  int(%i)
93  ["size"]=>
94  int(%d)
95  ["atime"]=>
96  int(%d)
97  ["mtime"]=>
98  int(%d)
99  ["ctime"]=>
100  int(%d)
101  ["blksize"]=>
102  int(%i)
103  ["blocks"]=>
104  int(%i)
105}
106array(26) {
107  [0]=>
108  int(%i)
109  [1]=>
110  int(%d)
111  [2]=>
112  int(%d)
113  [3]=>
114  int(%d)
115  [4]=>
116  int(%d)
117  [5]=>
118  int(%d)
119  [6]=>
120  int(%d)
121  [7]=>
122  int(%d)
123  [8]=>
124  int(%d)
125  [9]=>
126  int(%d)
127  [10]=>
128  int(%d)
129  [11]=>
130  int(%i)
131  [12]=>
132  int(%i)
133  ["dev"]=>
134  int(%i)
135  ["ino"]=>
136  int(%d)
137  ["mode"]=>
138  int(%d)
139  ["nlink"]=>
140  int(%d)
141  ["uid"]=>
142  int(%d)
143  ["gid"]=>
144  int(%d)
145  ["rdev"]=>
146  int(%i)
147  ["size"]=>
148  int(%d)
149  ["atime"]=>
150  int(%d)
151  ["mtime"]=>
152  int(%d)
153  ["ctime"]=>
154  int(%d)
155  ["blksize"]=>
156  int(%i)
157  ["blocks"]=>
158  int(%i)
159}
160
161-- Testing stat() on dir name stored inside an array --
162array(26) {
163  [0]=>
164  int(%i)
165  [1]=>
166  int(%d)
167  [2]=>
168  int(%d)
169  [3]=>
170  int(%d)
171  [4]=>
172  int(%d)
173  [5]=>
174  int(%d)
175  [6]=>
176  int(%d)
177  [7]=>
178  int(%d)
179  [8]=>
180  int(%d)
181  [9]=>
182  int(%d)
183  [10]=>
184  int(%d)
185  [11]=>
186  int(%i)
187  [12]=>
188  int(%i)
189  ["dev"]=>
190  int(%i)
191  ["ino"]=>
192  int(%d)
193  ["mode"]=>
194  int(%d)
195  ["nlink"]=>
196  int(%d)
197  ["uid"]=>
198  int(%d)
199  ["gid"]=>
200  int(%d)
201  ["rdev"]=>
202  int(%i)
203  ["size"]=>
204  int(%d)
205  ["atime"]=>
206  int(%d)
207  ["mtime"]=>
208  int(%d)
209  ["ctime"]=>
210  int(%d)
211  ["blksize"]=>
212  int(%i)
213  ["blocks"]=>
214  int(%i)
215}
216array(26) {
217  [0]=>
218  int(%i)
219  [1]=>
220  int(%d)
221  [2]=>
222  int(%d)
223  [3]=>
224  int(%d)
225  [4]=>
226  int(%d)
227  [5]=>
228  int(%d)
229  [6]=>
230  int(%d)
231  [7]=>
232  int(%d)
233  [8]=>
234  int(%d)
235  [9]=>
236  int(%d)
237  [10]=>
238  int(%d)
239  [11]=>
240  int(%i)
241  [12]=>
242  int(%i)
243  ["dev"]=>
244  int(%i)
245  ["ino"]=>
246  int(%d)
247  ["mode"]=>
248  int(%d)
249  ["nlink"]=>
250  int(%d)
251  ["uid"]=>
252  int(%d)
253  ["gid"]=>
254  int(%d)
255  ["rdev"]=>
256  int(%i)
257  ["size"]=>
258  int(%d)
259  ["atime"]=>
260  int(%d)
261  ["mtime"]=>
262  int(%d)
263  ["ctime"]=>
264  int(%d)
265  ["blksize"]=>
266  int(%i)
267  ["blocks"]=>
268  int(%i)
269}
270
271--- Done ---
272