From 32dd9cdc4572907f30d1c96863fa405094e53e15 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 4 Jan 2024 11:46:27 +0100 Subject: [PATCH] Fix deprecation with null value in cache FileStore --- src/Illuminate/Cache/FileStore.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Cache/FileStore.php b/src/Illuminate/Cache/FileStore.php index b18e568f6407..9d5e2e95c872 100755 --- a/src/Illuminate/Cache/FileStore.php +++ b/src/Illuminate/Cache/FileStore.php @@ -290,9 +290,11 @@ protected function getPayload($key) // just return null. Otherwise, we'll get the contents of the file and get // the expiration UNIX timestamps from the start of the file's contents. try { - $expire = substr( - $contents = $this->files->get($path, true), 0, 10 - ); + if (is_null($contents = $this->files->get($path, true))) { + return $this->emptyPayload(); + } + + $expire = substr($contents, 0, 10); } catch (Exception) { return $this->emptyPayload(); }