From 61334cf54e70fd542c616e3e29b8d9f64a70c4ae Mon Sep 17 00:00:00 2001 From: Clara <2524209+ClaraLeigh@users.noreply.github.com> Date: Wed, 7 May 2025 20:15:00 +1000 Subject: [PATCH] bugfix(redis-storage): Unserialise is sometimes false (#773) This is likely indicative of a deeper issue with the data being fetched but when there is a problem with unserialize, we should fallback to an empty array when the unserialize function returns false. --- src/DebugBar/Storage/RedisStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DebugBar/Storage/RedisStorage.php b/src/DebugBar/Storage/RedisStorage.php index f5e86a5..b27acc1 100644 --- a/src/DebugBar/Storage/RedisStorage.php +++ b/src/DebugBar/Storage/RedisStorage.php @@ -46,7 +46,7 @@ class RedisStorage implements StorageInterface */ public function get($id) { - return array_merge(unserialize($this->redis->hGet("$this->hash:data", $id)), + return array_merge(unserialize($this->redis->hGet("$this->hash:data", $id)) ?: [], array('__meta' => unserialize($this->redis->hGet("$this->hash:meta", $id)))); }