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