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

View file

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