diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index dd8e759b4a..9d07547fb6 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -125,16 +125,17 @@ public function getMultiple($keys, $default = null) $list = $this->doGetMultiple($keys, $this->miss); - if (count($list) !== count($keys)) { - foreach ($keys as $key) { - if (!array_key_exists($key, $list) || $list[$key] === $this->miss) { - $list[$key] = $default; - } + // Make sure that values are returned in the same order as the keys were given. + $values = []; + foreach ($keys as $key) { + if (!array_key_exists($key, $list) || $list[$key] === $this->miss) { + $values[$key] = $default; + } else { + $values[$key] = $list[$key]; } } - // Make sure that results are returned in the same order as the keys were given. - return array_replace(array_flip($keys), $list); + return $values; } /**