1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/standard/tests/file/bug72666_variation3.phpt
Jakub Zelenka 930624899b Fix bug #72666: stat cache not cleared for plain paths
This adds more aggressive clearing of stat cache. It is added to the
filestat as well as plain wrapper operations which covers stream file
accessing as well as exec functions (using pipes). It should hopefully
fix the most visible issues with the stat cache.

Closes GH-17681
2025-02-24 23:21:45 +01:00

36 lines
754 B
PHP

--TEST--
Bug #72666 (stat cache clearing inconsistent - plain wrapper)
--FILE--
<?php
$filename = __DIR__ . '/bug72666_variation3.txt';
file_put_contents($filename, "test");
$fd = fopen($filename, "r");
$atime1 = fileatime($filename);
sleep(1);
var_dump(fread($fd, 4));
$atime2 = fileatime($filename);
$mtime1 = filemtime($filename);
fclose($fd);
$fd = fopen($filename, "w");
sleep(1);
var_dump(fwrite($fd, "data"));
$mtime2 = filemtime($filename);
if (substr(PHP_OS, 0, 3) == 'WIN') {
// Windows do not hundle atime
var_dump($atime2 == $atime1);
} else {
var_dump($atime2 > $atime1);
}
var_dump($mtime2 > $mtime1);
?>
--CLEAN--
<?php
unlink(__DIR__ . '/bug72666_variation3.txt');
?>
--EXPECT--
string(4) "test"
int(4)
bool(true)
bool(true)