From 685c36c3d2695a7e4fe589675f0a79d4d7fe65bd Mon Sep 17 00:00:00 2001 From: Emanuele Panzeri Date: Wed, 27 Nov 2019 17:54:05 +0100 Subject: [PATCH] [Cache] Make sure we get the correct number of values from redis::mget() --- src/Symfony/Component/Cache/Traits/RedisTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 395a9b8051b4..c4b12b64bb37 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -179,7 +179,13 @@ protected function doFetch(array $ids) } }); } else { - $values = array_combine($ids, $this->redis->mget($ids)); + $values = $this->redis->mget($ids); + + if (!\is_array($values) || \count($values) !== \count($ids)) { + return []; + } + + $values = array_combine($ids, $values); } foreach ($values as $id => $v) {