1--TEST--
2Test lstat() and stat() functions: usage variations - effects changing permissions of link
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6if (PHP_OS_FAMILY === 'Windows') {
7    include_once __DIR__ . '/windows_links/common.inc';
8    skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
9}
10?>
11--FILE--
12<?php
13/* test the effects on stats by changing permissions of link */
14
15$file_path = __DIR__;
16require "$file_path/file.inc";
17
18
19$filename = "$file_path/lstat_stat_variation15.tmp";
20$fp = fopen($filename, "w");  // temp file
21fclose($fp);
22
23// temp link
24$linkname = "$file_path/lstat_stat_variation15_link.tmp";
25symlink($filename, $linkname);
26
27// checking lstat() and stat() on links
28echo "*** Testing lstat() on a link after changing its access permission ***\n";
29clearstatcache();
30$old_stat = lstat($linkname);
31var_dump( chmod($linkname, 0777) );
32// clear the stat
33clearstatcache();
34sleep(2);
35$new_stat = lstat($linkname);
36// compare self stats
37var_dump( compare_self_stat($old_stat) );
38var_dump( compare_self_stat($new_stat) );
39// compare the stat
40var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "==") );
41
42echo "\n--- Done ---";
43?>
44--CLEAN--
45<?php
46$file_path = __DIR__;
47unlink("$file_path/lstat_stat_variation15_link.tmp");
48unlink("$file_path/lstat_stat_variation15.tmp");
49?>
50--EXPECT--
51*** Testing lstat() on a link after changing its access permission ***
52bool(true)
53bool(true)
54bool(true)
55bool(true)
56
57--- Done ---
58