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