1--TEST--
2Test lstat() and stat() functions: usage variations - effects changing permissions of file
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7    die('skip.. Not valid for Windows');
8}
9?>
10--FILE--
11<?php
12/* Prototype: array lstat ( string $filename );
13   Description: Gives information about a file or symbolic link
14
15   Prototype: array stat ( string $filename );
16   Description: Gives information about a file
17*/
18
19/* test the effects on stats with changing permissions of file */
20
21$file_path = dirname(__FILE__);
22require "$file_path/file.inc";
23
24$filename = "$file_path/lstat_stat_variation16.tmp";
25$fp = fopen($filename, "w");  // temp file
26fclose($fp);
27
28// checking stat() on file after changing its permission
29echo "*** Testing lstat() on a file after changing its access permission ***\n";
30$old_stat = stat($filename);
31sleep(2);
32var_dump( chmod($filename, 0777) );
33// clear the stat
34clearstatcache();
35$new_stat = stat($filename);
36// compare self stats
37var_dump( compare_self_stat($old_stat) );
38var_dump( compare_self_stat($new_stat) );
39// compare the stat
40$affected_members = array(10, 'ctime');
41var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") );
42
43echo "\n--- Done ---";
44?>
45
46--CLEAN--
47<?php
48$file_path = dirname(__FILE__);
49unlink("$file_path/lstat_stat_variation16.tmp");
50?>
51--EXPECTF--
52*** Testing lstat() on a file after changing its access permission ***
53bool(true)
54bool(true)
55bool(true)
56bool(true)
57
58--- Done ---
59