diff options
author | yurihs <yurisalvador@hotmail.com> | 2019-10-02 23:03:40 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-10-02 23:03:40 +0300 |
commit | f64e2e2ae4ed7197b76cd582709da71a4e065757 (patch) | |
tree | 3e2e84c59905ebe9ebb39084df4ef27aa060b11c /plugins/RssWidget | |
parent | c6782cf50089d2926ca45fc50cb42da57fc85ff7 (diff) |
Fix XML parser warning handling in RssWidget (#14941)
* Fix XML parser warning handling in RssWidget
* Use error control operator to supress RSS feed parsing error
Diffstat (limited to 'plugins/RssWidget')
-rw-r--r-- | plugins/RssWidget/RssRenderer.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/RssWidget/RssRenderer.php b/plugins/RssWidget/RssRenderer.php index ca00fb7730..d512585fc6 100644 --- a/plugins/RssWidget/RssRenderer.php +++ b/plugins/RssWidget/RssRenderer.php @@ -56,7 +56,11 @@ class RssRenderer if (!$output) { try { $content = Http::fetchRemoteFile($this->url); - $rss = simplexml_load_string($content); + + $rss = @simplexml_load_string($content); + if ($rss === false) { + throw new \Exception("Failed to parse XML."); + } } catch (\Exception $e) { throw new \Exception("Error while importing feed: {$e->getMessage()}\n"); } |