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--CLEAN--
71<?php
72$file_path = dirname(__FILE__);
73unlink("$file_path/stat_variation6.tmp");
74rmdir("$file_path/stat_variation6");
75?>
76--EXPECTF--
77*** Testing stat() on file with miscelleneous file permission and content ***
78bool(true)
79bool(true)
80bool(true)
81bool(true)
82
83*** Testing stat() on directory with miscelleneous file permission ***
84bool(true)
85bool(true)
86bool(true)
87bool(true)
88
89*** Done ***
90