Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / http-kernel / HttpCache / ResponseCacheStrategy.php
index 39a99e6966c22ab46ae7997e193eb1a2308c31b9..027b2b1761334cd8ab712dc3194e6017b496442b 100644 (file)
@@ -39,7 +39,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
      */
     public function add(Response $response)
     {
-        if ($response->isValidateable()) {
+        if (!$response->isFresh() || !$response->isCacheable()) {
             $this->cacheable = false;
         } else {
             $maxAge = $response->getMaxAge();
@@ -70,6 +70,9 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
         if ($response->isValidateable()) {
             $response->setEtag(null);
             $response->setLastModified(null);
+        }
+
+        if (!$response->isFresh()) {
             $this->cacheable = false;
         }