diff --git a/core/lib/Drupal/Core/Cache/ApcuBackend.php b/core/lib/Drupal/Core/Cache/ApcuBackend.php index 06a99613f587..0ec166f45718 100644 --- a/core/lib/Drupal/Core/Cache/ApcuBackend.php +++ b/core/lib/Drupal/Core/Cache/ApcuBackend.php @@ -109,10 +109,12 @@ class ApcuBackend implements CacheBackendInterface { $result = apc_fetch(array_keys($map)); $cache = array(); - foreach ($result as $key => $item) { - $item = $this->prepareItem($item, $allow_invalid); - if ($item) { - $cache[$map[$key]] = $item; + if ($result) { + foreach ($result as $key => $item) { + $item = $this->prepareItem($item, $allow_invalid); + if ($item) { + $cache[$map[$key]] = $item; + } } } unset($result); @@ -358,8 +360,10 @@ class ApcuBackend implements CacheBackendInterface { foreach (array('deletions', 'invalidations') as $type) { if ($query_tags[$type]) { $result = apc_fetch($query_tags[$type]); - static::$tagCache[$type] = array_merge(static::$tagCache[$type], $result); - $checksum[$type] += array_sum($result); + if ($result) { + static::$tagCache[$type] = array_merge(static::$tagCache[$type], $result); + $checksum[$type] += array_sum($result); + } } }