Merge pull request #9953 from realkinetix/php8fatal

PHP 8 fatal messages - Quit when message is empty similar to #9681
This commit is contained in:
Hypolite Petovan 2021-02-23 16:16:54 -05:00 committed by GitHub
commit 22a1e3cba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -167,6 +167,10 @@ class HTML
$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
if (empty($message)) {
return '';
}
@$doc->loadHTML($message, LIBXML_HTML_NODEFDTD);
XML::deleteNode($doc, 'style');
@ -588,6 +592,10 @@ class HTML
$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
if (empty($message)) {
return '';
}
@$doc->loadHTML($message, LIBXML_HTML_NODEFDTD);
$message = $doc->saveHTML();

View File

@ -1754,6 +1754,10 @@ class Probe
*/
public static function getFeedLink(string $url, string $body)
{
if (empty($body)) {
return '';
}
$doc = new DOMDocument();
if (!@$doc->loadHTML($body)) {
return false;