1--TEST--
2Test stat() functions: usage variations - changing permissions of dir/file
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 effects on the stats of dir/file for changing permissions of dir/file */
13
14
15$file_path = __DIR__;
16require "$file_path/file.inc";
17
18
19/* create temp file and directory */
20$dirname = "$file_path/stat_variation6";
21mkdir($dirname);  // temp dir
22
23$filename = "$file_path/stat_variation6.tmp";
24$file_handle = fopen($filename, "w");  // temp file
25fclose($file_handle);
26
27
28// checking stat() on file
29echo "\n*** Testing stat() on file with miscellaneous file permission and content ***\n";
30clearstatcache();
31$old_stat = stat($filename);
32sleep(1);
33var_dump( chmod($filename, 0777) );
34// clear the stat
35clearstatcache();
36$new_stat = stat($filename);
37// compare self stats
38var_dump( compare_self_stat($old_stat) );
39var_dump( compare_self_stat($new_stat) );
40// compare the stat
41$affected_members = array( 10, 'ctime');
42var_dump( compare_stats($old_stat, $new_stat, $affected_members, "==") );
43// clear the stat
44clearstatcache();  // clear statement cache
45
46// checking stat() on directory
47echo "\n*** Testing stat() on directory with miscellaneous file permission ***\n";
48$old_stat = stat($dirname);
49sleep(1);
50var_dump( chmod($dirname, 0777) );
51// clear the stat
52clearstatcache();
53$new_stat = stat($dirname);
54// compare self stats
55var_dump( compare_self_stat($old_stat) );
56var_dump( compare_self_stat($new_stat) );
57// compare the stat
58$affected_members = array( 10, 'ctime');
59var_dump( compare_stats($old_stat, $new_stat, $affected_members, "==") );
60// clear the stat
61clearstatcache();  // clear statement cache
62
63
64echo "\n*** Done ***";
65?>
66--CLEAN--
67<?php
68$file_path = __DIR__;
69unlink("$file_path/stat_variation6.tmp");
70rmdir("$file_path/stat_variation6");
71?>
72--EXPECT--
73*** Testing stat() on file with miscellaneous file permission and content ***
74bool(true)
75bool(true)
76bool(true)
77bool(true)
78
79*** Testing stat() on directory with miscellaneous file permission ***
80bool(true)
81bool(true)
82bool(true)
83bool(true)
84
85*** Done ***
86