1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Merge pull request #9253 from kkmuffme/fix-lstat-bug-when-removing-cache-dir

fix lstat bug cache directory race condition
This commit is contained in:
orklah 2023-02-11 12:24:00 +01:00 committed by GitHub
commit 93267f298b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,6 @@ use function extension_loaded;
use function fclose;
use function file_exists;
use function file_get_contents;
use function filetype;
use function flock;
use function fopen;
use function get_class;
@ -2502,11 +2501,12 @@ class Config
$full_path = $dir . '/' . $object;
// if it was deleted in the meantime/race condition with other psalm process
clearstatcache(true, $full_path);
if (!file_exists($full_path)) {
continue;
}
if (filetype($full_path) === 'dir') {
if (is_dir($full_path)) {
self::removeCacheDirectory($full_path);
} else {
$fp = fopen($full_path, 'c');