1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of touch() on dir 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6if (substr(PHP_OS, 0, 3) == 'WIN') { 7 die('skip.. Not valid for Windows'); 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 touch() on stats of dir */ 20 21$file_path = __DIR__; 22require "$file_path/file.inc"; 23 24 25/* create temp directory */ 26 27$dir_name = "$file_path/lstat_stat_variation5"; 28@rmdir($dir_name); //ensure that dir doesn't exists 29mkdir($dir_name); // temp dir 30 31// touch a directory and check stat, there should be difference in atime 32echo "*** Testing stat() for directory after using touch() on the directory ***\n"; 33$old_stat = stat($dir_name); 34// clear the cache 35clearstatcache(); 36sleep(2); 37var_dump( touch($dir_name) ); 38$new_stat = stat($dir_name); 39 40// compare self stats 41var_dump( compare_self_stat($old_stat) ); 42var_dump( compare_self_stat($new_stat) ); 43 44// compare the stat 45$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime'); 46var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); 47// clear the cache 48clearstatcache(); 49 50echo "\n--- Done ---"; 51?> 52--CLEAN-- 53<?php 54$file_path = __DIR__; 55rmdir("$file_path/lstat_stat_variation5"); 56?> 57--EXPECT-- 58*** Testing stat() for directory after using touch() on the directory *** 59bool(true) 60bool(true) 61bool(true) 62bool(true) 63 64--- Done --- 65