1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of rename() on link 3--SKIPIF-- 4<?php 5if (PHP_OS_FAMILY === 'Windows') { 6 include_once __DIR__ . '/windows_links/common.inc'; 7 skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__); 8} 9?> 10--FILE-- 11<?php 12/* test the effects of rename() on stats of link */ 13 14$file_path = __DIR__; 15require "$file_path/file.inc"; 16 17/* create temp file & link */ 18$fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file 19fclose($fp); 20 21// temp link 22symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp"); 23 24// renaming a link 25echo "*** Testing lstat() for link after being renamed ***\n"; 26$old_linkname = "$file_path/lstat_stat_variation_link3.tmp"; 27$new_linkname = "$file_path/lstat_stat_variation_link3a.tmp"; 28$old_stat = lstat($old_linkname); 29clearstatcache(); 30var_dump( rename($old_linkname, $new_linkname) ); 31$new_stat = lstat($new_linkname); 32 33// compare self stats 34var_dump( compare_self_stat($old_stat) ); 35var_dump( compare_self_stat($new_stat) ); 36 37// compare the two stats - all except ctime 38$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 39 "dev", "ino", "mode", "nlink", "uid", "gid", 40 "rdev", "size", "atime", "mtime", "blksize", "blocks"); 41var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) ); 42?> 43--CLEAN-- 44<?php 45$file_path = __DIR__; 46unlink("$file_path/lstat_stat_variation3.tmp"); 47unlink("$file_path/lstat_stat_variation_link3a.tmp"); 48?> 49--EXPECT-- 50*** Testing lstat() for link after being renamed *** 51bool(true) 52bool(true) 53bool(true) 54bool(true) 55