From 5a1146c1da42822ffb05ccd0d69b2fda6cc422fb Mon Sep 17 00:00:00 2001 From: Kiel Date: Sat, 28 Sep 2024 14:50:35 +0100 Subject: [PATCH] Return Empty Dataset for Unsupported Redis Classes --- Model/RedisInfo.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Model/RedisInfo.php b/Model/RedisInfo.php index 4f452dc..30109f0 100644 --- a/Model/RedisInfo.php +++ b/Model/RedisInfo.php @@ -39,7 +39,9 @@ public function __construct( public function get(): array { - $redisInfo = $this->getAllRedisInfo(); + if (!($redisInfo = $this->getAllRedisInfo())) { + return []; + } return [ 'version' => $redisInfo['redis_version'], @@ -186,6 +188,8 @@ public function getHistoricRedisReportData(): array */ public function getAllRedisInfo(): array { - return $this->redis->getInfo(); + return $this->redis instanceof Cm_Cache_Backend_Redis && method_exists($this->redis, 'getInfo') + ? $this->redis->getInfo() + : []; } }