1--TEST--
2Test stat() functions: usage variations - file opened in read/write mode
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6    die('skip.. only for Windows');
7}
8?>
9--FILE--
10<?php
11
12/* test the stats of file opened in write mode and then same in read mode */
13
14$file_path = __DIR__;
15require "$file_path/file.inc";
16
17
18$file_handle = fopen("$file_path/stat_variation5.tmp", "w");  // temp file
19fclose($file_handle);
20
21
22echo "\n*** Testing stat(): on a file with read/write permission ***\n";
23
24$filename = "$file_path/stat_variation5.tmp";
25$file_handle = fopen($filename, "w");  // create file
26fclose($file_handle);
27$old_stat = stat($filename);
28// clear the stat
29clearstatcache();
30sleep(1);
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
39$affected_members = array(10, 'ctime');
40var_dump( compare_stats($old_stat, $new_stat, $affected_members, "==") );
41// clear the stat
42clearstatcache();
43
44
45echo "\n*** Done ***";
46?>
47--CLEAN--
48<?php
49$file_path = __DIR__;
50unlink("$file_path/stat_variation5.tmp");
51?>
52--EXPECT--
53*** Testing stat(): on a file with read/write permission ***
54bool(true)
55bool(true)
56bool(true)
57
58*** Done ***
59