hide uninteresting errors in several DOMDocument->loadHTML() invocations

This commit is contained in:
Andrew Dolgov 2020-10-01 13:20:07 +03:00
parent 24cdacd59e
commit 38a7a1da88
5 changed files with 8 additions and 8 deletions

View File

@ -286,7 +286,7 @@ class DiskCache {
if (!$res) return '';
$doc = new DOMDocument();
if ($doc->loadHTML('<?xml encoding="UTF-8">' . $res)) {
if (@$doc->loadHTML('<?xml encoding="UTF-8">' . $res)) {
$xpath = new DOMXPath($doc);
$cache = new DiskCache("images");

View File

@ -1930,7 +1930,7 @@ class Feeds extends Handler_Protected {
$feedUrls = [];
$doc = new DOMDocument();
if ($doc->loadHTML($content)) {
if (@$doc->loadHTML($content)) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('/html/head/link[@rel="alternate" and '.
'(contains(@type,"rss") or contains(@type,"atom"))]|/html/head/link[@rel="feed"]');

View File

@ -1341,9 +1341,9 @@ class RSSUtils {
static function cache_media($html, $site_url) {
$cache = new DiskCache("images");
if ($cache->isWritable()) {
if ($html && $cache->isWritable()) {
$doc = new DOMDocument();
if ($doc->loadHTML($html)) {
if (@$doc->loadHTML($html)) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('(//img[@src]|//source[@src|@srcset]|//video[@poster|@src])');
@ -1829,7 +1829,7 @@ class RSSUtils {
if ($html = @UrlHelper::fetch($url)) {
$doc = new DOMDocument();
if ($doc->loadHTML($html)) {
if (@$doc->loadHTML($html)) {
$xpath = new DOMXPath($doc);
$base = $xpath->query('/html/head/base[@href]');

View File

@ -111,7 +111,7 @@ class Af_RedditImgur extends Plugin {
if ($oembed_result && isset($oembed_result["html"])) {
$tmp = new DOMDocument();
if ($tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) {
if (@$tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) {
$p = $doc->createElement("p");
$p->appendChild($doc->importNode(

View File

@ -190,7 +190,7 @@ class Cache_Starred_Images extends Plugin {
$has_images = false;
$success = false;
if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
if (@$doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');