diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php index edda4d3..95c8458 100644 --- a/core/lib/Drupal/Core/Cache/MemoryBackend.php +++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php @@ -73,15 +73,10 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) { * valid item to load. */ protected function prepareItem($cache, $allow_invalid) { - if (!isset($cache->data)) { + if (!isset($cache['data'])) { return FALSE; } - // The object passed into this function is the one stored in $this->cache. - // We must clone it as part of the preparation step so that the actual - // cache object is not affected by the unserialize() call or other - // manipulations of the returned object. - - $prepared = clone $cache; + $prepared = (object) $cache; $prepared->data = unserialize($prepared->data); // Check expire time. @@ -102,7 +97,7 @@ public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = []) { $tags = array_unique($tags); // Sort the cache tags so that they are stored consistently in the database. sort($tags); - $this->cache[$cid] = (object) [ + $this->cache[$cid] = [ 'cid' => $cid, 'data' => serialize($data), 'created' => $this->getRequestTime(), @@ -146,7 +141,7 @@ public function deleteAll() { */ public function invalidate($cid) { if (isset($this->cache[$cid])) { - $this->cache[$cid]->expire = $this->getRequestTime() - 1; + $this->cache[$cid]['expire'] = $this->getRequestTime() - 1; } } @@ -156,7 +151,7 @@ public function invalidate($cid) { public function invalidateMultiple(array $cids) { foreach ($cids as $cid) { if (isset($this->cache[$cid])) { - $this->cache[$cid]->expire = $this->getRequestTime() - 1; + $this->cache[$cid]['expire'] = $this->getRequestTime() - 1; } } } @@ -166,8 +161,8 @@ public function invalidateMultiple(array $cids) { */ public function invalidateTags(array $tags) { foreach ($this->cache as $cid => $item) { - if (array_intersect($tags, $item->tags)) { - $this->cache[$cid]->expire = $this->getRequestTime() - 1; + if (array_intersect($tags, $item['tags'])) { + $this->cache[$cid]['expire'] = $this->getRequestTime() - 1; } } } @@ -177,7 +172,7 @@ public function invalidateTags(array $tags) { */ public function invalidateAll() { foreach ($this->cache as $cid => $item) { - $this->cache[$cid]->expire = $this->getRequestTime() - 1; + $this->cache[$cid]['expire'] = $this->getRequestTime() - 1; } }