From 3e38a24f0a28e9ad25dc322441ba45adf3bf2c02 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 31 Mar 2022 10:07:15 +0000 Subject: fix PHP error --- include/html2bbcode.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/html2bbcode.php b/include/html2bbcode.php index cc67a5666..0aa067371 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -87,7 +87,7 @@ function deletenode(&$doc, $node) function html2bbcode($message) { - if(!is_string($message) && !$message) + if(!is_string($message)) return; $message = str_replace("\r", "", $message); @@ -104,11 +104,14 @@ function html2bbcode($message) $message = preg_replace('=<(\w+):(.+?)>=', '', $message); $message = preg_replace('==', '', $message); + $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); + + if(!$message) + return; + $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; - $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); - @$doc->loadHTML($message); deletenode($doc, 'style'); -- cgit v1.2.3