From 5843fe571984790f79479cc5e80f41f29a691e18 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Wed, 4 Aug 2021 18:14:08 +0200 Subject: [PATCH] in high concurrency situations, with slow filesystems one request might delete (try to refresh) the cache entry after the file_exists check passed. this will result in a file not found error when including the file. to avoid such situations we ignore this type of errors --- src/Cache/FileCache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cache/FileCache.php b/src/Cache/FileCache.php index b07b94f..32ce746 100644 --- a/src/Cache/FileCache.php +++ b/src/Cache/FileCache.php @@ -25,7 +25,7 @@ public function __construct(string $dir) public function load(string $class): ?ClassMetadata { $path = $this->getCachePath($class); - if (!file_exists($path)) { + if (!is_readable($path)) { return null; } @@ -35,7 +35,7 @@ public function load(string $class): ?ClassMetadata return $metadata; } // if the file does not return anything, the return value is integer `1`. - } catch (\ParseError $e) { + } catch (\Error $e) { // ignore corrupted cache }