diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php index 120b01e..1c4d8f5 100644 --- a/core/modules/page_cache/src/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -283,13 +283,15 @@ protected function storeResponse(Request $request, Response $response) { $expire = $request_time + $cache_ttl_4xx; } } - else { - // The getExpires method could return NULL if Expires header is not set, so - // the returned value needs to be checked before calling getTimestamp. - $expires = $response->getExpires(); - $date = ($expires == NULL) ? 0 : $expires->getTimestamp(); + // The getExpires method could return NULL if Expires header is not set, so + // the returned value needs to be checked before calling getTimestamp. + elseif ($expires = $response->getExpires()) { + $date = $expires->getTimestamp(); $expire = ($date > $request_time) ? $date : Cache::PERMANENT; } + else { + $expire = Cache::PERMANENT; + } if ($expire === Cache::PERMANENT || $expire > $request_time) { $tags = $response->getCacheableMetadata()->getCacheTags();