From 962b06bf41e773ace6c898df510043f3cda206f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 16 Jun 2022 15:45:22 +0200 Subject: [PATCH] Added check as suggested by @MrPetovan for empty $message. --- src/Content/Text/HTML.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 9a5b909256..9121087296 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -143,6 +143,14 @@ class HTML */ public static function toBBCode(string $message, string $basepath = ''): string { + /* + * Check if message is empty to prevent a lot code below being executed + * for just an empty message. + */ + if (empty($message)) { + return ''; + } + DI::profiler()->startRecording('rendering'); $message = str_replace("\r", "", $message);