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