Loading core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php +2 −1 Original line number Diff line number Diff line Loading @@ -123,9 +123,10 @@ public function onException(GetResponseForExceptionEvent $event) { } } $content_type = $event->getRequest()->getRequestFormat() == 'html' ? 'text/html' : 'text/plain'; $content = $this->t('The website encountered an unexpected error. Please try again later.'); $content .= $message ? '</br></br>' . $message : ''; $response = new Response($content, 500, ['Content-Type' => 'text/plain']); $response = new Response($content, 500, ['Content-Type' => $content_type]); if ($exception instanceof HttpExceptionInterface) { $response->setStatusCode($exception->getStatusCode()); Loading core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ public function testBacktraceEscaping() { $kernel = \Drupal::getContainer()->get('http_kernel'); $response = $kernel->handle($request)->prepare($request); $this->assertEqual($response->getStatusCode(), Response::HTTP_INTERNAL_SERVER_ERROR); $this->assertEqual($response->headers->get('Content-type'), 'text/plain; charset=UTF-8'); $this->assertEqual($response->headers->get('Content-type'), 'text/html; charset=UTF-8'); // Test both that the backtrace is properly escaped, and that the unescaped // string is not output at all. Loading @@ -180,7 +180,7 @@ public function testExceptionEscaping() { $kernel = \Drupal::getContainer()->get('http_kernel'); $response = $kernel->handle($request)->prepare($request); $this->assertEqual($response->getStatusCode(), Response::HTTP_INTERNAL_SERVER_ERROR); $this->assertEqual($response->headers->get('Content-type'), 'text/plain; charset=UTF-8'); $this->assertEqual($response->headers->get('Content-type'), 'text/html; charset=UTF-8'); // Test message is properly escaped, and that the unescaped string is not // output at all. Loading Loading
core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php +2 −1 Original line number Diff line number Diff line Loading @@ -123,9 +123,10 @@ public function onException(GetResponseForExceptionEvent $event) { } } $content_type = $event->getRequest()->getRequestFormat() == 'html' ? 'text/html' : 'text/plain'; $content = $this->t('The website encountered an unexpected error. Please try again later.'); $content .= $message ? '</br></br>' . $message : ''; $response = new Response($content, 500, ['Content-Type' => 'text/plain']); $response = new Response($content, 500, ['Content-Type' => $content_type]); if ($exception instanceof HttpExceptionInterface) { $response->setStatusCode($exception->getStatusCode()); Loading
core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ public function testBacktraceEscaping() { $kernel = \Drupal::getContainer()->get('http_kernel'); $response = $kernel->handle($request)->prepare($request); $this->assertEqual($response->getStatusCode(), Response::HTTP_INTERNAL_SERVER_ERROR); $this->assertEqual($response->headers->get('Content-type'), 'text/plain; charset=UTF-8'); $this->assertEqual($response->headers->get('Content-type'), 'text/html; charset=UTF-8'); // Test both that the backtrace is properly escaped, and that the unescaped // string is not output at all. Loading @@ -180,7 +180,7 @@ public function testExceptionEscaping() { $kernel = \Drupal::getContainer()->get('http_kernel'); $response = $kernel->handle($request)->prepare($request); $this->assertEqual($response->getStatusCode(), Response::HTTP_INTERNAL_SERVER_ERROR); $this->assertEqual($response->headers->get('Content-type'), 'text/plain; charset=UTF-8'); $this->assertEqual($response->headers->get('Content-type'), 'text/html; charset=UTF-8'); // Test message is properly escaped, and that the unescaped string is not // output at all. Loading