Explorar o código

[HttpKernel] tweaked the default ESI cache strategy

Fabien Potencier %!s(int64=14) %!d(string=hai) anos
pai
achega
9844685a40

+ 4 - 3
src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php

@@ -60,9 +60,10 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface
             return;
         }
 
-        $maxAge = min($this->maxAges);
-        $response->setSharedMaxAge($maxAge);
+        if (null !== $maxAge = min($this->maxAges)) {
+            $response->setSharedMaxAge($maxAge);
+            $response->headers->set('Age', $maxAge - min($this->ttls));
+        }
         $response->setMaxAge(0);
-        $response->headers->set('Age', $maxAge - min($this->ttls));
     }
 }