1--TEST-- 2Test lstat() and stat() functions: usage variations - writing data into file 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip.. Not valid for Windows'); 7} 8?> 9--FILE-- 10<?php 11/* Prototype: array lstat ( string $filename ); 12 Description: Gives information about a file or symbolic link 13 14 Prototype: array stat ( string $filename ); 15 Description: Gives information about a file 16*/ 17 18$file_path = dirname(__FILE__); 19require "$file_path/file.inc"; 20 21/* test the effects on stats with writing data into a file */ 22 23$file_name = "$file_path/lstat_stat_variation7.tmp"; 24$fp = fopen($file_name, "w"); // temp file 25fclose($fp); 26 27// writing to an empty file 28echo "*** Testing stat() on file after data is written in it ***\n"; 29$fh = fopen($file_name,"w"); 30$old_stat = stat($file_name); 31clearstatcache(); 32fwrite($fh, str_repeat("Hello World", $old_stat['blksize'])); 33$new_stat = stat($file_name); 34 35// compare self stats 36var_dump( compare_self_stat($old_stat) ); 37var_dump( compare_self_stat($new_stat) ); 38// compare the stats 39$comp_arr = array(7, 12, 'size', 'blocks'); 40var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); 41clearstatcache(); 42 43echo "\n--- Done ---"; 44?> 45--CLEAN-- 46<?php 47$file_path = dirname(__FILE__); 48unlink("$file_path/lstat_stat_variation7.tmp"); 49?> 50--EXPECT-- 51*** Testing stat() on file after data is written in it *** 52bool(true) 53bool(true) 54bool(true) 55 56--- Done --- 57