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 __construct($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--CLEAN--
65<?php
66$file_path = dirname(__FILE__);
67unlink("$file_path/stat_variation7.tmp");
68unlink("$file_path/stat_variation7a.tmp");
69rmdir("$file_path/stat_variation7");
70rmdir("$file_path/stat_variation7a");
71?>
72--EXPECTF--
73*** Testing stat(): with filename
74    and directory name stored inside a object ***
75
76-- Testing stat() on filename stored inside an object --
77array(26) {
78  [0]=>
79  int(%d)
80  [1]=>
81  int(%d)
82  [2]=>
83  int(%d)
84  [3]=>
85  int(%d)
86  [4]=>
87  int(%d)
88  [5]=>
89  int(%d)
90  [6]=>
91  int(%d)
92  [7]=>
93  int(%d)
94  [8]=>
95  int(%d)
96  [9]=>
97  int(%d)
98  [10]=>
99  int(%d)
100  [11]=>
101  int(-%d)
102  [12]=>
103  int(-%d)
104  ["dev"]=>
105  int(%d)
106  ["ino"]=>
107  int(%d)
108  ["mode"]=>
109  int(%d)
110  ["nlink"]=>
111  int(%d)
112  ["uid"]=>
113  int(%d)
114  ["gid"]=>
115  int(%d)
116  ["rdev"]=>
117  int(%d)
118  ["size"]=>
119  int(%d)
120  ["atime"]=>
121  int(%d)
122  ["mtime"]=>
123  int(%d)
124  ["ctime"]=>
125  int(%d)
126  ["blksize"]=>
127  int(-%d)
128  ["blocks"]=>
129  int(-%d)
130}
131array(26) {
132  [0]=>
133  int(%d)
134  [1]=>
135  int(%d)
136  [2]=>
137  int(%d)
138  [3]=>
139  int(%d)
140  [4]=>
141  int(%d)
142  [5]=>
143  int(%d)
144  [6]=>
145  int(%d)
146  [7]=>
147  int(%d)
148  [8]=>
149  int(%d)
150  [9]=>
151  int(%d)
152  [10]=>
153  int(%d)
154  [11]=>
155  int(-%d)
156  [12]=>
157  int(-%d)
158  ["dev"]=>
159  int(%d)
160  ["ino"]=>
161  int(%d)
162  ["mode"]=>
163  int(%d)
164  ["nlink"]=>
165  int(%d)
166  ["uid"]=>
167  int(%d)
168  ["gid"]=>
169  int(%d)
170  ["rdev"]=>
171  int(%d)
172  ["size"]=>
173  int(%d)
174  ["atime"]=>
175  int(%d)
176  ["mtime"]=>
177  int(%d)
178  ["ctime"]=>
179  int(%d)
180  ["blksize"]=>
181  int(-%d)
182  ["blocks"]=>
183  int(-%d)
184}
185
186-- Testing stat() on directory name stored inside an object --
187array(26) {
188  [0]=>
189  int(%d)
190  [1]=>
191  int(%d)
192  [2]=>
193  int(%d)
194  [3]=>
195  int(%d)
196  [4]=>
197  int(%d)
198  [5]=>
199  int(%d)
200  [6]=>
201  int(%d)
202  [7]=>
203  int(%d)
204  [8]=>
205  int(%d)
206  [9]=>
207  int(%d)
208  [10]=>
209  int(%d)
210  [11]=>
211  int(-%d)
212  [12]=>
213  int(-%d)
214  ["dev"]=>
215  int(%d)
216  ["ino"]=>
217  int(%d)
218  ["mode"]=>
219  int(%d)
220  ["nlink"]=>
221  int(%d)
222  ["uid"]=>
223  int(%d)
224  ["gid"]=>
225  int(%d)
226  ["rdev"]=>
227  int(%d)
228  ["size"]=>
229  int(%d)
230  ["atime"]=>
231  int(%d)
232  ["mtime"]=>
233  int(%d)
234  ["ctime"]=>
235  int(%d)
236  ["blksize"]=>
237  int(-%d)
238  ["blocks"]=>
239  int(-%d)
240}
241array(26) {
242  [0]=>
243  int(%d)
244  [1]=>
245  int(%d)
246  [2]=>
247  int(%d)
248  [3]=>
249  int(%d)
250  [4]=>
251  int(%d)
252  [5]=>
253  int(%d)
254  [6]=>
255  int(%d)
256  [7]=>
257  int(%d)
258  [8]=>
259  int(%d)
260  [9]=>
261  int(%d)
262  [10]=>
263  int(%d)
264  [11]=>
265  int(-%d)
266  [12]=>
267  int(-%d)
268  ["dev"]=>
269  int(%d)
270  ["ino"]=>
271  int(%d)
272  ["mode"]=>
273  int(%d)
274  ["nlink"]=>
275  int(%d)
276  ["uid"]=>
277  int(%d)
278  ["gid"]=>
279  int(%d)
280  ["rdev"]=>
281  int(%d)
282  ["size"]=>
283  int(%d)
284  ["atime"]=>
285  int(%d)
286  ["mtime"]=>
287  int(%d)
288  ["ctime"]=>
289  int(%d)
290  ["blksize"]=>
291  int(-%d)
292  ["blocks"]=>
293  int(-%d)
294}
295
296*** Done ***
297