1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of is_dir() 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6?> 7--FILE-- 8<?php 9/* test the effects of is_dir() on stats of a dir */ 10 11$file_path = __DIR__; 12require "$file_path/file.inc"; 13 14 15/* create temp file, link and directory */ 16$dirname = "$file_path/lstat_stat_variation10"; 17mkdir($dirname); // temp dir 18 19// is_dir() on a directory 20echo "*** Testing stat() on directory after using is_dir() on it ***\n"; 21$old_stat = stat($dirname); 22// clear the cache 23clearstatcache(); 24sleep(1); 25var_dump( is_dir($dirname) ); 26$new_stat = stat($dirname); 27 28// compare self stats 29var_dump( compare_self_stat($old_stat) ); 30var_dump( compare_self_stat($new_stat) ); 31// activity from background processes may unexpectedly update the atime 32// so don't include "atime" (or 8, which also means atime) 33$compare_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 34 "dev", "ino", "mode", "nlink", "uid", "gid", 35 "rdev", "size", "mtime", "ctime", 36 "blksize", "blocks"); 37// compare the stat 38var_dump( compare_stats($old_stat, $new_stat, $compare_keys) ); 39 40echo "\n--- Done ---"; 41?> 42--CLEAN-- 43<?php 44$file_path = __DIR__; 45rmdir("$file_path/lstat_stat_variation10"); 46?> 47--EXPECT-- 48*** Testing stat() on directory after using is_dir() on it *** 49bool(true) 50bool(true) 51bool(true) 52bool(true) 53 54--- Done --- 55