From 3eaf0b7f23aded75894848664420658e429dce5a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 16 Feb 2021 12:56:34 +0000 Subject: php8 another fix --- include/html2plain.php | 8 +++++--- include/oembed.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/html2plain.php b/include/html2plain.php index fde70bd01..91a1f14cb 100644 --- a/include/html2plain.php +++ b/include/html2plain.php @@ -102,12 +102,14 @@ function html2plain($html, $wraplength = 75, $compact = false) { $message = str_replace("\r", "", $html); + $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); - $doc = new DOMDocument(); - $doc->preserveWhiteSpace = false; + if(!$message) + return; - $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); + $doc = new DOMDocument(); + $doc->preserveWhiteSpace = false; @$doc->loadHTML($message); $xpath = new DomXPath($doc); diff --git a/include/oembed.php b/include/oembed.php index 235069c1b..b6060c878 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -181,7 +181,7 @@ function oembed_fetch_url($embedurl){ if($html_text) { $dom = new DOMDocument; - $dom->loadHTML($html_text); + @$dom->loadHTML($html_text); if ($dom){ $xpath = new DOMXPath($dom); $attr = "oembed"; -- cgit v1.2.3