From e7df4bdf2cb6e268eaf74c513e72b9bf1903b5cc Mon Sep 17 00:00:00 2001 From: Mark Huot Date: Mon, 30 Sep 2024 17:38:03 -0400 Subject: [PATCH] check file existence before filemtime calling filemtime with a nonexistent file will cause a warning, even with the `@` error suppression. This avoids the warning by checking file existence before the modification time --- framework/caching/FileCache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/caching/FileCache.php b/framework/caching/FileCache.php index aaa5049fef9..f79c7deaddc 100644 --- a/framework/caching/FileCache.php +++ b/framework/caching/FileCache.php @@ -97,7 +97,7 @@ public function exists($key) { $cacheFile = $this->getCacheFile($this->buildKey($key)); - return @filemtime($cacheFile) > time(); + return file_exists($cacheFile) && @filemtime($cacheFile) > time(); } /** @@ -110,7 +110,7 @@ protected function getValue($key) { $cacheFile = $this->getCacheFile($key); - if (@filemtime($cacheFile) > time()) { + if (file_exists($cacheFile) && @filemtime($cacheFile) > time()) { $fp = @fopen($cacheFile, 'r'); if ($fp !== false) { @flock($fp, LOCK_SH);