From e065d637d9aff8e59e44d5c0553fd4c50509951c Mon Sep 17 00:00:00 2001 From: filip Date: Tue, 13 Apr 2021 12:41:24 +0200 Subject: update SimplePie for compatibility php 7.4 and 8 --- lib/simplepie/library/SimplePie/Locator.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/simplepie/library/SimplePie/Locator.php') diff --git a/lib/simplepie/library/SimplePie/Locator.php b/lib/simplepie/library/SimplePie/Locator.php index 3876a2da6..ebc7ec9c1 100644 --- a/lib/simplepie/library/SimplePie/Locator.php +++ b/lib/simplepie/library/SimplePie/Locator.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -75,12 +75,19 @@ class SimplePie_Locator $this->force_fsockopen = $force_fsockopen; $this->curl_options = $curl_options; - if (class_exists('DOMDocument')) + if (class_exists('DOMDocument') && $this->file->body != '') { $this->dom = new DOMDocument(); set_error_handler(array('SimplePie_Misc', 'silence_errors')); - $this->dom->loadHTML($this->file->body); + try + { + $this->dom->loadHTML($this->file->body); + } + catch (Throwable $ex) + { + $this->dom = null; + } restore_error_handler(); } else @@ -94,7 +101,7 @@ class SimplePie_Locator $this->registry = $registry; } - public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) + public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working = null) { if ($this->is_feed($this->file)) { @@ -402,7 +409,7 @@ class SimplePie_Locator { break; } - if (preg_match('/(rss|rdf|atom|xml)/i', $value)) + if (preg_match('/(feed|rss|rdf|atom|xml)/i', $value)) { $this->checked_feeds++; $headers = array( -- cgit v1.2.1