1--TEST-- 2Test lstat() and stat() functions: usage variations - writing data into file 3--FILE-- 4<?php 5$file_path = __DIR__; 6require "$file_path/file.inc"; 7 8/* test the effects on stats with writing data into a file */ 9 10$file_name = "$file_path/lstat_stat_variation7.tmp"; 11$fp = fopen($file_name, "w"); // temp file 12fclose($fp); 13 14// writing to an empty file 15echo "*** Testing stat() on file after data is written in it ***\n"; 16$fh = fopen($file_name,"w"); 17$old_stat = stat($file_name); 18clearstatcache(); 19$blksize = PHP_OS_FAMILY === 'Windows' ? 4096 : $old_stat['blksize']; 20fwrite($fh, str_repeat("Hello World", $blksize)); 21fclose($fh); 22$new_stat = stat($file_name); 23 24// compare self stats 25var_dump( compare_self_stat($old_stat) ); 26var_dump( compare_self_stat($new_stat) ); 27// compare the stats 28$comp_arr = array(7, 'size'); 29var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); 30clearstatcache(); 31 32echo "\n--- Done ---"; 33?> 34--CLEAN-- 35<?php 36$file_path = __DIR__; 37unlink("$file_path/lstat_stat_variation7.tmp"); 38?> 39--EXPECT-- 40*** Testing stat() on file after data is written in it *** 41bool(true) 42bool(true) 43bool(true) 44 45--- Done --- 46