Return to lstat_stat_variation14.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test lstat() and stat() functions: usage variations - hardlink 3: --SKIPIF-- 4: <?php 5: if (substr(PHP_OS, 0, 3) == 'WIN') { 6: die('skip.. lstat() not available on 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 the effects of is_link() on stats of hard link */ 19: 20: $file_path = dirname(__FILE__); 21: require "$file_path/file.inc"; 22: 23: 24: /* create temp file & link */ 25: $filename = "$file_path/lstat_stat_variation14.tmp"; 26: $fp = fopen($filename, "w"); // temp file 27: fclose($fp); 28: 29: echo "*** Checking lstat() and stat() on hard link ***\n"; 30: $linkname = "$file_path/lstat_stat_variation14_hard.tmp"; 31: //ensure that link doesn't exists 32: @unlink($linkname); 33: 34: // create the link 35: var_dump( link($filename, $linkname) ); 36: $file_stat = stat($filename); 37: $link_stat = lstat($linkname); 38: // compare self stats 39: var_dump( compare_self_stat($file_stat) ); 40: var_dump( compare_self_stat($link_stat) ); 41: // compare the stat 42: var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) ); 43: // clear the stat 44: clearstatcache(); 45: 46: echo "\n--- Done ---"; 47: ?> 48: 49: --CLEAN-- 50: <?php 51: $file_path = dirname(__FILE__); 52: unlink("$file_path/lstat_stat_variation14_hard.tmp"); 53: unlink("$file_path/lstat_stat_variation14.tmp"); 54: ?> 55: --EXPECTF-- 56: *** Checking lstat() and stat() on hard link *** 57: bool(true) 58: bool(true) 59: bool(true) 60: bool(true) 61: 62: --- Done ---