1--TEST-- 2Test lstat() and stat() functions: usage variations - file opened using w and r mode 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/* use stat on file created using "w" and "r" mode of fopen */ 17 18$file_path = __DIR__; 19require "$file_path/file.inc"; 20 21 22$filename = "$file_path/lstat_stat_variation13.tmp"; 23 24echo "*** Checking stat() on a file opened using read/write mode ***\n"; 25$file_handle = fopen($filename, "w"); // create file 26fclose($file_handle); 27$old_stat = stat($filename); 28// clear the stat 29clearstatcache(); 30sleep(2); 31// opening file again in read mode 32$file_handle = fopen($filename, "r"); // read file 33fclose($file_handle); 34$new_stat = stat($filename); 35// compare self stats 36var_dump( compare_self_stat($old_stat) ); 37var_dump( compare_self_stat($new_stat) ); 38// compare the stat 39var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); 40 41echo "\n--- Done ---"; 42?> 43--CLEAN-- 44<?php 45$file_path = __DIR__; 46unlink("$file_path/lstat_stat_variation13.tmp"); 47?> 48--EXPECT-- 49*** Checking stat() on a file opened using read/write mode *** 50bool(true) 51bool(true) 52bool(true) 53 54--- Done --- 55