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/* Prototype: array lstat ( string $filename ); 13 Description: Gives information about a file or symbolic link 14 15 Prototype: array stat ( string $filename ); 16 Description: Gives information about a file 17*/ 18 19/* test the effects of rename() on stats of link */ 20 21$file_path = __DIR__; 22require "$file_path/file.inc"; 23 24/* create temp file & link */ 25$fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file 26fclose($fp); 27 28// temp link 29symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp"); 30 31// renaming a link 32echo "*** Testing lstat() for link after being renamed ***\n"; 33$old_linkname = "$file_path/lstat_stat_variation_link3.tmp"; 34$new_linkname = "$file_path/lstat_stat_variation_link3a.tmp"; 35$old_stat = lstat($old_linkname); 36clearstatcache(); 37var_dump( rename($old_linkname, $new_linkname) ); 38$new_stat = lstat($new_linkname); 39 40// compare self stats 41var_dump( compare_self_stat($old_stat) ); 42var_dump( compare_self_stat($new_stat) ); 43 44// compare the two stats - all except ctime 45$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 46 "dev", "ino", "mode", "nlink", "uid", "gid", 47 "rdev", "size", "atime", "mtime", "blksize", "blocks"); 48var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) ); 49?> 50===Done=== 51--CLEAN-- 52<?php 53$file_path = __DIR__; 54unlink("$file_path/lstat_stat_variation3.tmp"); 55unlink("$file_path/lstat_stat_variation_link3a.tmp"); 56?> 57--EXPECT-- 58*** Testing lstat() for link after being renamed *** 59bool(true) 60bool(true) 61bool(true) 62bool(true) 63===Done=== 64