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