core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php | 10 +++++----- core/lib/Drupal/Core/Render/RenderCache.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php b/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php index 8f3ff6e..61220f5 100644 --- a/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php +++ b/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php @@ -61,9 +61,9 @@ class PlaceholderingRenderCache extends RenderCache { * @see ::set() * @see ::maxAgeToOverride() * - * @var FALSE|int + * @var NULL|int */ - protected $expireOverride = FALSE; + protected $expireOverride = NULL; /** * Constructs a new PlaceholderingRenderCache object. @@ -128,14 +128,14 @@ public function set(array &$elements, array $pre_bubbling_elements) { // a #lazy_builder callback. // Note: we can permanently cache the fact that this element's subtree // resulted in a bubbled max-age=0, because cache context variations - if ($result === FALSE && $this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->requestStack->getCurrentRequest()->isMethodSafe() && !$this->maxAgeAllowsCaching($elements) && $this->maxAgeAllowsCaching($pre_bubbling_elements) && $cid = $this->createCacheID($elements)) { + if ($result === FALSE && $this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements) && $this->requestStack->getCurrentRequest()->isMethodSafe() && !$this->maxAgeAllowsCaching($elements) && $this->maxAgeAllowsCaching($pre_bubbling_elements) && $cid = $this->createCacheID($elements)) { // Cache #cache['max-age'] = 0! We just want to cache the cacheability. $data = ['#cache' => $elements['#cache'], '#markup' => '', '#attached' => []]; // $this->expireOverride = Cache::PERMANENT; parent::doSet($data, $pre_bubbling_elements); - $this->expireOverride = FALSE; + $this->expireOverride = NULL; } if ($this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements)) { @@ -154,7 +154,7 @@ public function set(array &$elements, array $pre_bubbling_elements) { protected function maxAgeToExpire($max_age) { // This is a quite hacky override, but otherwise this would have to // reimplement all of \Drupal\Core\Render\RenderCache::doSet(). - if ($this->expireOverride !== FALSE) { + if (isset($this->expireOverride)) { return $this->expireOverride; } return parent::maxAgeToExpire($max_age); diff --git a/core/lib/Drupal/Core/Render/RenderCache.php b/core/lib/Drupal/Core/Render/RenderCache.php index a64dec9..1845f24 100644 --- a/core/lib/Drupal/Core/Render/RenderCache.php +++ b/core/lib/Drupal/Core/Render/RenderCache.php @@ -64,7 +64,7 @@ public function get(array $elements) { // and render caching of forms prevents this from happening. // @todo remove the isMethodSafe() check when // https://www.drupal.org/node/2367555 lands. - if (!$this->requestStack->getCurrentRequest()->isMethodSafe() || !$this->maxAgeAllowsCaching($elements) || !isset($elements['#cache']['keys'])) { + if (!$this->requestStack->getCurrentRequest()->isMethodSafe() || !isset($elements['#cache']['keys']) || !$this->maxAgeAllowsCaching($elements)) { return FALSE; } $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'render';