From 4b1d77cc86e7fdad425a9a0a9d2d7ff8ef5621bc Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 6 Dec 2020 11:13:19 +0100 Subject: [PATCH] tpl fixes, dont use printHtml for none-string types --- Views/ViewAbstract.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index 3d584948a..e6b04eaaa 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -81,29 +81,29 @@ abstract class ViewAbstract implements RenderableInterface /** * Print html output. * - * @param string $text Text + * @param ?string $text Text * * @return string * * @since 1.0.0 */ - public function printHtml(string $text) : string + public function printHtml(?string $text) : string { - return \htmlspecialchars($text); + return $text === null ? '' : \htmlspecialchars($text); } /** * Print html output. * - * @param string $text Text + * @param ?string $text Text * * @return string * * @since 1.0.0 */ - public static function html(string $text) : string + public static function html(?string $text) : string { - return \htmlspecialchars($text); + return $text === null ? '' : \htmlspecialchars($text); } /** @@ -247,6 +247,7 @@ abstract class ViewAbstract implements RenderableInterface } catch (\Throwable $e) { \ob_end_clean(); $ob = ''; + echo $e->getMessage(); } finally { return $ob; }