1--TEST-- 2Phar: test stat function interceptions 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip");?> 5--INI-- 6phar.require_hash=1 7phar.readonly=0 8--FILE-- 9<?php 10Phar::interceptFileFuncs(); 11var_dump(stat("")); 12 13$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 14$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar'; 15$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar'; 16$a = new Phar($fname); 17$a['my/index.php'] = '<?php 18echo "stat\n"; 19var_dump(stat("dir/file1.txt")); 20echo "lstat\n"; 21var_dump(lstat("dir/file1.txt")); 22echo "fileperms\n"; 23var_dump(fileperms("dir/file1.txt")); 24echo "fileinode\n"; 25var_dump(fileinode("dir/file1.txt")); 26echo "filesize\n"; 27var_dump(filesize("dir/file1.txt")); 28echo "fileowner\n"; 29var_dump(fileowner("dir/file1.txt")); 30echo "filegroup\n"; 31var_dump(filegroup("dir/file1.txt")); 32echo "filemtime\n"; 33var_dump(filemtime("dir/file1.txt")); 34echo "fileatime\n"; 35var_dump(fileatime("dir/file1.txt")); 36echo "filectime\n"; 37var_dump(filectime("dir/file1.txt")); 38echo "filetype\n"; 39var_dump(filetype("dir/file1.txt")); 40echo "is_writable\n"; 41var_dump(is_writable("dir/file1.txt")); 42echo "is_writeable\n"; 43var_dump(is_writeable("dir/file1.txt")); 44echo "is_readable\n"; 45var_dump(is_readable("dir/file1.txt")); 46echo "is_executable\n"; 47var_dump(is_executable("dir/file1.txt")); 48echo "file_exists\n"; 49var_dump(file_exists("dir/file1.txt")); 50echo "is_dir\n"; 51var_dump(is_dir("dir/file1.txt")); 52echo "is_file\n"; 53var_dump(is_file("dir/file1.txt")); 54echo "is_link\n"; 55var_dump(is_link("dir/file1.txt")); 56echo "not found\n"; 57var_dump(file_exists("not/found")); 58echo "not found 2\n"; 59var_dump(fileperms("not/found")); 60?>'; 61$a['dir/file1.txt'] = 'hi'; 62$a['dir/file2.txt'] = 'hi2'; 63$a['dir/file3.txt'] = 'hi3'; 64$a->setStub('<?php 65set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__); 66include "my/index.php"; 67__HALT_COMPILER();'); 68include $fname; 69?> 70===DONE=== 71--CLEAN-- 72<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 73--EXPECTF-- 74bool(false) 75stat 76array(26) { 77 [0]=> 78 int(12) 79 [1]=> 80 int(%d) 81 [2]=> 82 int(33206) 83 [3]=> 84 int(1) 85 [4]=> 86 int(0) 87 [5]=> 88 int(0) 89 [6]=> 90 int(%s) 91 [7]=> 92 int(2) 93 [8]=> 94 int(%d) 95 [9]=> 96 int(%d) 97 [10]=> 98 int(%d) 99 [11]=> 100 int(%s) 101 [12]=> 102 int(%s) 103 ["dev"]=> 104 int(12) 105 ["ino"]=> 106 int(%d) 107 ["mode"]=> 108 int(33206) 109 ["nlink"]=> 110 int(1) 111 ["uid"]=> 112 int(0) 113 ["gid"]=> 114 int(0) 115 ["rdev"]=> 116 int(%s) 117 ["size"]=> 118 int(2) 119 ["atime"]=> 120 int(%d) 121 ["mtime"]=> 122 int(%d) 123 ["ctime"]=> 124 int(%d) 125 ["blksize"]=> 126 int(%s) 127 ["blocks"]=> 128 int(%s) 129} 130lstat 131array(26) { 132 [0]=> 133 int(12) 134 [1]=> 135 int(%d) 136 [2]=> 137 int(33206) 138 [3]=> 139 int(1) 140 [4]=> 141 int(0) 142 [5]=> 143 int(0) 144 [6]=> 145 int(%s) 146 [7]=> 147 int(2) 148 [8]=> 149 int(%d) 150 [9]=> 151 int(%d) 152 [10]=> 153 int(%d) 154 [11]=> 155 int(%s) 156 [12]=> 157 int(%s) 158 ["dev"]=> 159 int(12) 160 ["ino"]=> 161 int(%d) 162 ["mode"]=> 163 int(33206) 164 ["nlink"]=> 165 int(1) 166 ["uid"]=> 167 int(0) 168 ["gid"]=> 169 int(0) 170 ["rdev"]=> 171 int(%s) 172 ["size"]=> 173 int(2) 174 ["atime"]=> 175 int(%d) 176 ["mtime"]=> 177 int(%d) 178 ["ctime"]=> 179 int(%d) 180 ["blksize"]=> 181 int(%s) 182 ["blocks"]=> 183 int(%s) 184} 185fileperms 186int(33206) 187fileinode 188int(%d) 189filesize 190int(2) 191fileowner 192int(0) 193filegroup 194int(0) 195filemtime 196int(%d) 197fileatime 198int(%d) 199filectime 200int(%d) 201filetype 202string(4) "file" 203is_writable 204bool(true) 205is_writeable 206bool(false) 207is_readable 208bool(true) 209is_executable 210bool(false) 211file_exists 212bool(true) 213is_dir 214bool(false) 215is_file 216bool(true) 217is_link 218bool(false) 219not found 220bool(false) 221not found 2 222 223Warning: fileperms(): stat failed for not/found in phar://%sstat.phar.php/my/index.php on line %d 224bool(false) 225===DONE===