File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
lib/internal/Magento/Framework/App Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ private function initErrorHandler()
386
386
$ handler = new ErrorHandler ();
387
387
set_error_handler ([$ handler , 'handler ' ]);
388
388
}
389
-
389
+
390
390
/**
391
391
* Getter for error code
392
392
*
@@ -428,9 +428,13 @@ public function isDeveloperMode()
428
428
*/
429
429
protected function terminate (\Throwable $ e )
430
430
{
431
-
431
+ /** @var \Magento\Framework\HTTP\PhpEnvironment\Response $response */
432
+ $ response = $ this ->objectManager ->get (\Magento \Framework \HTTP \PhpEnvironment \Response::class);
433
+ $ response ->clearHeaders ();
434
+ $ response ->setHttpResponseCode (500 );
435
+ $ response ->setHeader ('Content-Type ' , 'text/plain ' );
432
436
if ($ this ->isDeveloperMode ()) {
433
- echo $ e ;
437
+ $ response -> setBody ( $ e ) ;
434
438
} else {
435
439
$ message = "An error has happened during application run. See exception log for details. \n" ;
436
440
try {
@@ -441,8 +445,9 @@ protected function terminate(\Throwable $e)
441
445
} catch (\Exception $ e ) {
442
446
$ message .= "Could not write error message to log. Please use developer mode to see the message. \n" ;
443
447
}
444
- echo $ message ;
448
+ $ response -> setBody ( $ message) ;
445
449
}
450
+ $ response ->sendResponse ();
446
451
exit (1 );
447
452
}
448
453
// phpcs:enable
You can’t perform that action at this time.
0 commit comments