1--TEST-- 2Test lstat() and stat() functions: usage variations - effects changing permissions of link 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6if (PHP_OS_FAMILY === 'Windows') { 7 include_once __DIR__ . '/windows_links/common.inc'; 8 skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__); 9} 10?> 11--FILE-- 12<?php 13/* Prototype: array lstat ( string $filename ); 14 Description: Gives information about a file or symbolic link 15 16 Prototype: array stat ( string $filename ); 17 Description: Gives information about a file 18*/ 19 20/* test the effects on stats by changing permissions of link */ 21 22$file_path = __DIR__; 23require "$file_path/file.inc"; 24 25 26$filename = "$file_path/lstat_stat_variation15.tmp"; 27$fp = fopen($filename, "w"); // temp file 28fclose($fp); 29 30// temp link 31$linkname = "$file_path/lstat_stat_variation15_link.tmp"; 32symlink($filename, $linkname); 33 34// checking lstat() and stat() on links 35echo "*** Testing lstat() on a link after changing its access permission ***\n"; 36clearstatcache(); 37$old_stat = lstat($linkname); 38var_dump( chmod($linkname, 0777) ); 39// clear the stat 40clearstatcache(); 41sleep(2); 42$new_stat = lstat($linkname); 43// compare self stats 44var_dump( compare_self_stat($old_stat) ); 45var_dump( compare_self_stat($new_stat) ); 46// compare the stat 47var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "==") ); 48 49echo "\n--- Done ---"; 50?> 51--CLEAN-- 52<?php 53$file_path = __DIR__; 54unlink("$file_path/lstat_stat_variation15_link.tmp"); 55unlink("$file_path/lstat_stat_variation15.tmp"); 56?> 57--EXPECT-- 58*** Testing lstat() on a link after changing its access permission *** 59bool(true) 60bool(true) 61bool(true) 62bool(true) 63 64--- Done --- 65