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