From: fabrixxm Date: Fri, 5 Aug 2022 13:28:21 +0000 (+0200) Subject: Fix WSOD when Renderer throws exception X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=704bd95608b15e66046e92aa03fdff9d55dbffb0;p=friendica.git Fix WSOD when Renderer throws exception `HTTPException` builds a simple static version of error page if `Renderer` throws any exception while rendering the error page. --- diff --git a/src/Module/Special/HTTPException.php b/src/Module/Special/HTTPException.php index 8b520f6b5a..0cd7817ed4 100644 --- a/src/Module/Special/HTTPException.php +++ b/src/Module/Special/HTTPException.php @@ -70,8 +70,17 @@ class HTTPException $content = ''; if ($e->getCode() >= 400) { - $tpl = Renderer::getMarkupTemplate('http_status.tpl'); - $content = Renderer::replaceMacros($tpl, self::getVars($e)); + $vars = self::getVars($e); + try { + $tpl = Renderer::getMarkupTemplate('http_status.tpl'); + $content = Renderer::replaceMacros($tpl, $vars); + } catch (\Exception $e) { + $content = "

{$vars['$title']}

{$vars['$message']}

"; + if (DI::app()->isSiteAdmin()) { + $content .= "

{$vars['$thrown']}

"; + $content .= "
{$vars['$trace']}
"; + } + } } System::httpError($e->getCode(), $e->getDescription(), $content);