1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
--TEST--
Test lstat() and stat() functions: usage variations - dir/file name stored in object
--FILE--
<?php
/* test for stats of dir/file when their names are stored in objects */
$file_path = __DIR__;
require "$file_path/file.inc";
/* create temp file and directory */
mkdir("$file_path/lstat_stat_variation18/"); // temp dir
$fp = fopen("$file_path/lstat_stat_variation18.tmp", "w"); // temp file
fclose($fp);
echo "*** Testing stat() with filename & directory name stored inside an object ***\n";
class names {
public $var_name;
public function __construct($name) {
$this->var_name = $name;
}
}
// directory name stored in an object
$dir_name = new names("$file_path/lstat_stat_variation18");
// file name stored in an object
$file_name = new names("$file_path/lstat_stat_variation18.tmp");
echo "\n-- Testing stat() on filename stored inside an object --\n";
// dump the stat returned value
var_dump( stat($file_name->var_name) );
echo "\n-- Testing stat() on directory name stored inside an object --\n";
// dump the stat returned value
var_dump( stat($dir_name->var_name) );
echo "\n--- Done ---";
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink("$file_path/lstat_stat_variation18.tmp");
rmdir("$file_path/lstat_stat_variation18");
?>
--EXPECTF--
*** Testing stat() with filename & directory name stored inside an object ***
-- Testing stat() on filename stored inside an object --
array(26) {
[0]=>
int(%i)
[1]=>
int(%d)
[2]=>
int(%d)
[3]=>
int(%d)
[4]=>
int(%d)
[5]=>
int(%d)
[6]=>
int(%d)
[7]=>
int(%d)
[8]=>
int(%d)
[9]=>
int(%d)
[10]=>
int(%d)
[11]=>
int(%i)
[12]=>
int(%i)
["dev"]=>
int(%i)
["ino"]=>
int(%d)
["mode"]=>
int(%d)
["nlink"]=>
int(%d)
["uid"]=>
int(%d)
["gid"]=>
int(%d)
["rdev"]=>
int(%i)
["size"]=>
int(%d)
["atime"]=>
int(%d)
["mtime"]=>
int(%d)
["ctime"]=>
int(%d)
["blksize"]=>
int(%i)
["blocks"]=>
int(%i)
}
-- Testing stat() on directory name stored inside an object --
array(26) {
[0]=>
int(%i)
[1]=>
int(%d)
[2]=>
int(%d)
[3]=>
int(%d)
[4]=>
int(%d)
[5]=>
int(%d)
[6]=>
int(%d)
[7]=>
int(%d)
[8]=>
int(%d)
[9]=>
int(%d)
[10]=>
int(%d)
[11]=>
int(%i)
[12]=>
int(%i)
["dev"]=>
int(%i)
["ino"]=>
int(%d)
["mode"]=>
int(%d)
["nlink"]=>
int(%d)
["uid"]=>
int(%d)
["gid"]=>
int(%d)
["rdev"]=>
int(%i)
["size"]=>
int(%d)
["atime"]=>
int(%d)
["mtime"]=>
int(%d)
["ctime"]=>
int(%d)
["blksize"]=>
int(%i)
["blocks"]=>
int(%i)
}
--- Done ---
|