1--TEST--
2Test lstat() and stat() functions: usage variations - dir/file name stored in object
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 objects */
19
20$file_path = dirname(__FILE__);
21require "$file_path/file.inc";
22
23
24/* create temp file and directory */
25mkdir("$file_path/lstat_stat_variation18/");  // temp dir
26$fp = fopen("$file_path/lstat_stat_variation18.tmp", "w");  // temp file
27fclose($fp);
28
29echo "*** Testing stat() with filename & directory name stored inside an object ***\n";
30
31class names {
32  public $var_name;
33  public function __construct($name) {
34    $this->var_name = $name;
35  }
36}
37
38// directory name stored in an object
39$dir_name = new names("$file_path/lstat_stat_variation18");
40
41// file name stored in an object
42$file_name = new names("$file_path/lstat_stat_variation18.tmp");
43
44echo "\n-- Testing stat() on filename stored inside an object --\n";
45// dump the stat returned value
46var_dump( stat($file_name->var_name) );
47
48echo "\n-- Testing stat() on directory name stored inside an object --\n";
49// dump the stat returned value
50var_dump( stat($dir_name->var_name) );
51
52echo "\n--- Done ---";
53?>
54
55--CLEAN--
56<?php
57$file_path = dirname(__FILE__);
58unlink("$file_path/lstat_stat_variation18.tmp");
59rmdir("$file_path/lstat_stat_variation18");
60?>
61--EXPECTF--
62*** Testing stat() with filename & directory name stored inside an object ***
63
64-- Testing stat() on filename stored inside an object --
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}
119
120-- Testing stat() on directory name stored inside an object --
121array(26) {
122  [0]=>
123  int(%d)
124  [1]=>
125  int(%d)
126  [2]=>
127  int(%d)
128  [3]=>
129  int(%d)
130  [4]=>
131  int(%d)
132  [5]=>
133  int(%d)
134  [6]=>
135  int(%d)
136  [7]=>
137  int(%d)
138  [8]=>
139  int(%d)
140  [9]=>
141  int(%d)
142  [10]=>
143  int(%d)
144  [11]=>
145  int(%d)
146  [12]=>
147  int(%d)
148  ["dev"]=>
149  int(%d)
150  ["ino"]=>
151  int(%d)
152  ["mode"]=>
153  int(%d)
154  ["nlink"]=>
155  int(%d)
156  ["uid"]=>
157  int(%d)
158  ["gid"]=>
159  int(%d)
160  ["rdev"]=>
161  int(%d)
162  ["size"]=>
163  int(%d)
164  ["atime"]=>
165  int(%d)
166  ["mtime"]=>
167  int(%d)
168  ["ctime"]=>
169  int(%d)
170  ["blksize"]=>
171  int(%d)
172  ["blocks"]=>
173  int(%d)
174}
175
176--- Done ---
177