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/*
13 *  Prototype: array stat ( string $filename );
14 *  Description: Gives information about a file
15 */
16
17/* test the stats of file opened in write mode and then same in read mode */
18
19$file_path = dirname(__FILE__);
20require "$file_path/file.inc";
21
22
23$file_handle = fopen("$file_path/stat_variation5.tmp", "w");  // temp file
24fclose($file_handle);
25
26
27echo "\n*** Testing stat(): on a file with read/write permission ***\n";
28
29$filename = "$file_path/stat_variation5.tmp";
30$file_handle = fopen($filename, "w");  // create file
31fclose($file_handle);
32$old_stat = stat($filename);
33// clear the stat
34clearstatcache();
35sleep(2);
36// opening file again in read mode
37$file_handle = fopen($filename, "r");  // read file
38fclose($file_handle);
39$new_stat = stat($filename);
40// compare self stats
41var_dump( compare_self_stat($old_stat) );
42var_dump( compare_self_stat($new_stat) );
43// compare the stat
44$affected_members = array(10, 'ctime');
45var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
46// clear the stat
47clearstatcache();
48
49
50echo "\n*** Done ***";
51?>
52--CLEAN--
53<?php
54$file_path = dirname(__FILE__);
55unlink("$file_path/stat_variation5.tmp");
56?>
57--EXPECTF--
58*** Testing stat(): on a file with read/write permission ***
59bool(true)
60bool(true)
61bool(true)
62
63*** Done ***
64