From 8926759864fd3449f3348df93096643247e1a70a Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 18 May 2015 06:06:36 +0100 Subject: [PATCH] Issue #2475001 by chris_hall_hu_cheng, jcnventura: Cache DateTime exception when Timezone not set --- core/modules/page_cache/src/StackMiddleware/PageCache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php index 71239219468..4c4bdf99ce8 100644 --- a/core/modules/page_cache/src/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -222,8 +222,8 @@ class PageCache implements HttpKernelInterface { } // Use the actual timestamp from an Expires header, if available. - $date = $response->getExpires(); - $expire = ($date > (new \DateTime())) ? $date->getTimestamp() : Cache::PERMANENT; + $date = $response->getExpires()->getTimestamp(); + $expire = ($date > time()) ? $date : Cache::PERMANENT; $tags = explode(' ', $response->headers->get('X-Drupal-Cache-Tags')); $this->set($request, $response, $expire, $tags);