diff -u b/core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php b/core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php --- b/core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php +++ b/core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php @@ -44,16 +44,7 @@ * Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getMultiple(). */ public function getMultiple(array $keys) { - $results = array(); - // Foreach only needs to traverse $keys once, the PHP implementation - // array_intersect_key(array_flip(array_values($keys)), $this->data); - // would be slower. - foreach ($keys as $key) { - if (isset($this->data[$key])) { - $results[$key] = $this->data[$key]; - } - } - return $results; + return array_intersect_key($this->data, array_flip($keys)); } /**