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