1--TEST-- 2Phar: test stat function interceptions and is_file/is_link edge cases (PHP 5.3+) 3--EXTENSIONS-- 4phar 5--INI-- 6phar.readonly=0 7phar.require_hash=0 8--FILE-- 9<?php 10Phar::interceptFileFuncs(); 11var_dump(is_file(__FILE__)); 12 13$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar'; 14$fname3 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar'; 15copy(__DIR__ . '/tar/files/links.tar', $fname2); 16$a = new PharData($fname2); 17$b = $a->convertToExecutable(Phar::TAR, Phar::NONE, '.phar.tar'); 18unset($a); 19Phar::unlinkArchive($fname2); 20$b['foo/stat.php'] = '<?php 21echo "is_link\n"; 22var_dump(is_link("./stat.php"),is_file("./stat.php"), is_link("./oops"), is_file("./oops")); 23var_dump(is_link("testit/link"), filetype("testit/link"), filetype("testit"), is_file("testit/link")); 24echo "not found\n"; 25var_dump(is_link("notfound")); 26echo "dir\n"; 27var_dump(is_dir("./bar"), is_file("foo/bar/blah")); 28?>'; 29$b->addEmptyDir('foo/bar/blah'); 30$b->setStub('<?php 31include "phar://" . __FILE__ . "/foo/stat.php"; 32__HALT_COMPILER();'); 33include $fname3; 34?> 35--CLEAN-- 36<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> 37<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?> 38--EXPECT-- 39bool(true) 40is_link 41bool(false) 42bool(true) 43bool(false) 44bool(false) 45bool(true) 46string(4) "link" 47string(3) "dir" 48bool(true) 49not found 50bool(false) 51dir 52bool(true) 53bool(false) 54