1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of touch() on file 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6?> 7--FILE-- 8<?php 9/* Prototype: array lstat ( string $filename ); 10 Description: Gives information about a file or symbolic link 11 12 Prototype: array stat ( string $filename ); 13 Description: Gives information about a file 14*/ 15 16/* test the effects of touch() on stats of file */ 17 18$file_path = __DIR__; 19require "$file_path/file.inc"; 20 21 22/* create temp file */ 23 24$file_name = "$file_path/lstat_stat_variation4.tmp"; 25$fp = fopen($file_name, "w"); // temp file 26fclose($fp); 27 28// touch a file check stat, there should be difference in atime 29echo "*** Testing stat() for file after using touch() on the file ***\n"; 30$old_stat = stat($file_name); 31// clear the cache 32clearstatcache(); 33sleep(2); 34var_dump( touch($file_name) ); 35$new_stat = stat($file_name); 36 37// compare self stats 38var_dump( compare_self_stat($old_stat) ); 39var_dump( compare_self_stat($new_stat) ); 40 41// compare the stat 42$affected_members = array(8, 'atime'); 43var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); 44// clear the cache 45clearstatcache(); 46 47echo "\n--- Done ---"; 48?> 49--CLEAN-- 50<?php 51$file_path = __DIR__; 52unlink("$file_path/lstat_stat_variation4.tmp"); 53?> 54--EXPECT-- 55*** Testing stat() for file after using touch() on the file *** 56bool(true) 57bool(true) 58bool(true) 59bool(true) 60 61--- Done --- 62