1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of is_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 of is_link() on stats of link */ 21 22$file_path = __DIR__; 23require "$file_path/file.inc"; 24 25 26/* create temp file, link */ 27$filename = "$file_path/lstat_stat_variation12.tmp"; 28$fp = fopen($filename, "w"); // temp file 29fclose($fp); 30 31$linkname = "$file_path/lstat_stat_variation12_link.tmp"; 32symlink($filename, $linkname); // temp link 33 34// is_link() on a link 35echo "*** Testing stat() on a link after using is_link() on it ***\n"; 36$linkname = "$file_path/lstat_stat_variation12_link.tmp"; 37$old_stat = lstat($linkname); 38// clear the stat 39clearstatcache(); 40sleep(2); 41var_dump( is_link($linkname) ); 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// clear the stat 49clearstatcache(); 50 51echo "\n--- Done ---"; 52?> 53--CLEAN-- 54<?php 55$file_path = __DIR__; 56unlink("$file_path/lstat_stat_variation12_link.tmp"); 57unlink("$file_path/lstat_stat_variation12.tmp"); 58?> 59--EXPECT-- 60*** Testing stat() on a link after using is_link() on it *** 61bool(true) 62bool(true) 63bool(true) 64bool(true) 65 66--- Done --- 67