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/* test the effects of is_link() on stats of link */ 14 15$file_path = __DIR__; 16require "$file_path/file.inc"; 17 18 19/* create temp file, link */ 20$filename = "$file_path/lstat_stat_variation12.tmp"; 21$fp = fopen($filename, "w"); // temp file 22fclose($fp); 23 24$linkname = "$file_path/lstat_stat_variation12_link.tmp"; 25symlink($filename, $linkname); // temp link 26 27// is_link() on a link 28echo "*** Testing stat() on a link after using is_link() on it ***\n"; 29$linkname = "$file_path/lstat_stat_variation12_link.tmp"; 30$old_stat = lstat($linkname); 31// clear the stat 32clearstatcache(); 33sleep(1); 34var_dump( is_link($linkname) ); 35$new_stat = lstat($linkname); 36// compare self stats 37var_dump( compare_self_stat($old_stat) ); 38var_dump( compare_self_stat($new_stat) ); 39// compare the stat 40var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); 41// clear the stat 42clearstatcache(); 43 44echo "\n--- Done ---"; 45?> 46--CLEAN-- 47<?php 48$file_path = __DIR__; 49unlink("$file_path/lstat_stat_variation12_link.tmp"); 50unlink("$file_path/lstat_stat_variation12.tmp"); 51?> 52--EXPECT-- 53*** Testing stat() on a link after using is_link() on it *** 54bool(true) 55bool(true) 56bool(true) 57bool(true) 58 59--- Done --- 60