diff --git a/lib/internal/Magento/Framework/App/ExceptionHandler.php b/lib/internal/Magento/Framework/App/ExceptionHandler.php index d1bd09da256af..d0d38804c0697 100644 --- a/lib/internal/Magento/Framework/App/ExceptionHandler.php +++ b/lib/internal/Magento/Framework/App/ExceptionHandler.php @@ -1,7 +1,7 @@ clearHeader('Location'); $response->setHttpResponseCode(500); - $response->setHeader('Content-Type', 'text/plain'); + $response->setHeader('Content-Type', 'text/html'); $response->setBody($this->buildContentFromException($exception)); $response->sendResponse(); return true; @@ -122,11 +122,11 @@ private function buildContentFromException(\Exception $exception): string $exceptions[] = $exception; } while ($exception = $exception->getPrevious()); - $buffer = sprintf("%d exception(s):\n", count($exceptions)); + $buffer = sprintf("
%d exception(s):
\n", count($exceptions)); foreach ($exceptions as $index => $exception) { $buffer .= sprintf( - "Exception #%d (%s): %s\n", + "
Exception #%d (%s): %s
\n", $index, get_class($exception), $exception->getMessage() @@ -135,7 +135,7 @@ private function buildContentFromException(\Exception $exception): string foreach ($exceptions as $index => $exception) { $buffer .= sprintf( - "\nException #%d (%s): %s\n%s\n", + "
\n
Exception #%d (%s): %s\n%s
\n", $index, get_class($exception), $exception->getMessage(), diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ExceptionHandlerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ExceptionHandlerTest.php index 53340c7812a66..126b70dd0893f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ExceptionHandlerTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ExceptionHandlerTest.php @@ -1,7 +1,7 @@ with(500); $this->responseMock->expects($this->once()) ->method('setHeader') - ->with('Content-Type', 'text/plain'); - $constraint = new StringStartsWith('1 exception(s):'); + ->with('Content-Type', 'text/html'); + $constraint = new StringStartsWith('
1 exception(s):
'); $this->responseMock->expects($this->once()) ->method('setBody') ->with($constraint);