From 76a2e6254531df64214cc8db2a89a00121dc626b Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 21 Apr 2023 14:27:31 +0200 Subject: [PATCH] [Cache] Fix success interpretation when pruning cache --- src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php | 2 +- src/Symfony/Component/Cache/Traits/FilesystemTrait.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 2fb08375a1b40..d47c4053011cd 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -82,7 +82,7 @@ public function prune() } if ($time >= $expiresAt) { - $pruned = $this->doUnlink($file) && !file_exists($file) && $pruned; + $pruned = ($this->doUnlink($file) || !file_exists($file)) && $pruned; } } } finally { diff --git a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php index 38b741f1cc9c3..f2873d9efd528 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php @@ -40,7 +40,7 @@ public function prune() if (($expiresAt = (int) fgets($h)) && $time >= $expiresAt) { fclose($h); - $pruned = @unlink($file) && !file_exists($file) && $pruned; + $pruned = (@unlink($file) || !file_exists($file)) && $pruned; } else { fclose($h); }