Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php Mon Apr 23 09:46:53 2018 +0100 @@ -2,6 +2,7 @@ namespace Drupal\Core\EventSubscriber; +use Drupal\Core\Cache\CacheableResponseInterface; use Drupal\Core\Routing\RedirectDestinationInterface; use Drupal\Core\Utility\Error; use Psr\Log\LoggerInterface; @@ -170,6 +171,13 @@ $response->setStatusCode($status_code); } + // Persist the exception's cacheability metadata, if any. If the exception + // itself isn't cacheable, then this will make the response uncacheable: + // max-age=0 will be set. + if ($response instanceof CacheableResponseInterface) { + $response->addCacheableDependency($exception); + } + // Persist any special HTTP headers that were set on the exception. if ($exception instanceof HttpExceptionInterface) { $response->headers->add($exception->getHeaders());