From cddca5cfa3c87dbccb83c095bc99ee94a462206b Mon Sep 17 00:00:00 2001 From: Brent Scheffler Date: Fri, 20 Oct 2023 09:43:19 -0700 Subject: [PATCH] Guarding against null values before unserializing. This addresses E_DEPRECATED notices in PHP 8.2 when unserializing as it the function signature now only accepts string values. --- src/Adapter/Predis/PredisCachePool.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Adapter/Predis/PredisCachePool.php b/src/Adapter/Predis/PredisCachePool.php index f1ec6eee..cc43d26a 100644 --- a/src/Adapter/Predis/PredisCachePool.php +++ b/src/Adapter/Predis/PredisCachePool.php @@ -42,11 +42,13 @@ public function __construct(Client $cache) */ protected function fetchObjectFromCache($key) { - if (false === $result = unserialize($this->cache->get($this->getHierarchyKey($key)))) { + $result = $this->cache->get($this->getHierarchyKey($key)); + + if (false === $result || null === $result) { return [false, null, [], null]; } - return $result; + return unserialize($result); } /**