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