diff --git a/installation/src/Application/InstallationApplication.php b/installation/src/Application/InstallationApplication.php index 3b25150290aea..c0957aa518815 100644 --- a/installation/src/Application/InstallationApplication.php +++ b/installation/src/Application/InstallationApplication.php @@ -250,14 +250,14 @@ public function execute() { $this->compress(); } - - // Send the application response. - $this->respond(); } catch (\Throwable $throwable) { ExceptionHandler::render($throwable); } + + // Send the application response. + $this->respond(); } /** diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 82b594ddefae2..eb03a7b844d23 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -386,12 +386,6 @@ public function execute() // Trigger the onAfterCompress event. $this->triggerEvent('onAfterCompress'); } - - // Send the application response. - $this->respond(); - - // Trigger the onAfterRespond event. - $this->triggerEvent('onAfterRespond'); } catch (\Throwable $throwable) { @@ -410,6 +404,12 @@ public function execute() ExceptionHandler::render($event->getError()); } + + // Send the application response. + $this->respond(); + + // Trigger the onAfterRespond event. + $this->triggerEvent('onAfterRespond'); } /** diff --git a/libraries/src/Exception/ExceptionHandler.php b/libraries/src/Exception/ExceptionHandler.php index 5f91937317228..22e111adec9dd 100644 --- a/libraries/src/Exception/ExceptionHandler.php +++ b/libraries/src/Exception/ExceptionHandler.php @@ -10,6 +10,7 @@ defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Error\AbstractRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Log\Log; @@ -140,12 +141,12 @@ public static function render(\Throwable $error) } else { + /** @var CMSApplication $app */ + // Do not allow cache $app->allowCache(false); $app->setBody($data); - - echo $app->toString(); } // This return is needed to ensure the test suite does not trigger the non-Exception handling below