Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Core\EventSubscriber; | 3 namespace Drupal\Core\EventSubscriber; |
4 | 4 |
5 use Drupal\Core\Cache\CacheableResponseInterface; | |
5 use Drupal\Core\Routing\RedirectDestinationInterface; | 6 use Drupal\Core\Routing\RedirectDestinationInterface; |
6 use Drupal\Core\Utility\Error; | 7 use Drupal\Core\Utility\Error; |
7 use Psr\Log\LoggerInterface; | 8 use Psr\Log\LoggerInterface; |
8 use Symfony\Component\HttpFoundation\Response; | 9 use Symfony\Component\HttpFoundation\Response; |
9 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | 10 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; |
168 // @see https://www.drupal.org/node/2603788#comment-10504916 | 169 // @see https://www.drupal.org/node/2603788#comment-10504916 |
169 if ($response->isSuccessful()) { | 170 if ($response->isSuccessful()) { |
170 $response->setStatusCode($status_code); | 171 $response->setStatusCode($status_code); |
171 } | 172 } |
172 | 173 |
174 // Persist the exception's cacheability metadata, if any. If the exception | |
175 // itself isn't cacheable, then this will make the response uncacheable: | |
176 // max-age=0 will be set. | |
177 if ($response instanceof CacheableResponseInterface) { | |
178 $response->addCacheableDependency($exception); | |
179 } | |
180 | |
173 // Persist any special HTTP headers that were set on the exception. | 181 // Persist any special HTTP headers that were set on the exception. |
174 if ($exception instanceof HttpExceptionInterface) { | 182 if ($exception instanceof HttpExceptionInterface) { |
175 $response->headers->add($exception->getHeaders()); | 183 $response->headers->add($exception->getHeaders()); |
176 } | 184 } |
177 | 185 |