tpl fixes, dont use printHtml for none-string types

This commit is contained in:
Dennis Eichhorn 2020-12-06 11:13:19 +01:00
parent f5ad4345bb
commit 4b1d77cc86

View File

@ -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;
}