xref: /PHP-8.4/ext/standard/tests/file/bug39367.phpt (revision 7edc5e5e)
1--TEST--
2Bug #39367 (clearstatcache() doesn't clear realpath cache)
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip not for Windows');
7}
8?>
9--FILE--
10<?php
11function test() {
12  unlink('/tmp/1link');
13  unlink('/tmp/1tmp');
14  unlink('/tmp/testfile1');
15
16  file_put_contents('/tmp/testfile1', 'ok');
17  symlink('/tmp/testfile1', '/tmp/1tmp');
18  rename('/tmp/1tmp', '/tmp/1link');
19  echo file_get_contents('/tmp/1link')."\n";
20
21  unlink('/tmp/1link');
22  clearstatcache(true);
23
24  echo file_get_contents('/tmp/1link')."\n";
25
26  unlink('/tmp/1link');
27  unlink('/tmp/1tmp');
28  unlink('/tmp/testfile1');
29}
30@test();
31?>
32--EXPECT--
33ok
34