From 6d8aabab2347feabdd804b609dcd4513f09f78d4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 09:21:19 +0000 Subject: composer libs minor version updates --- vendor/simplepie/simplepie/.travis.yml | 30 ------- vendor/simplepie/simplepie/CHANGELOG.md | 65 ++++++++++++--- vendor/simplepie/simplepie/autoloader.php | 2 + vendor/simplepie/simplepie/composer.json | 2 +- vendor/simplepie/simplepie/library/SimplePie.php | 95 +++++++++++++++++++--- .../library/SimplePie/Cache/Memcached.php | 0 .../simplepie/library/SimplePie/Cache/Redis.php | 2 +- .../simplepie/library/SimplePie/Enclosure.php | 7 +- .../simplepie/simplepie/library/SimplePie/File.php | 3 +- .../simplepie/library/SimplePie/HTTP/Parser.php | 10 ++- .../simplepie/simplepie/library/SimplePie/Item.php | 11 +-- .../simplepie/library/SimplePie/Locator.php | 12 ++- .../simplepie/simplepie/library/SimplePie/Misc.php | 10 +++ .../simplepie/library/SimplePie/Parser.php | 24 +++++- .../simplepie/library/SimplePie/Registry.php | 3 +- .../simplepie/library/SimplePie/Sanitize.php | 72 ++++++++++++++++ 16 files changed, 278 insertions(+), 70 deletions(-) delete mode 100644 vendor/simplepie/simplepie/.travis.yml mode change 100644 => 100755 vendor/simplepie/simplepie/library/SimplePie.php mode change 100644 => 100755 vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php mode change 100644 => 100755 vendor/simplepie/simplepie/library/SimplePie/Registry.php (limited to 'vendor/simplepie') diff --git a/vendor/simplepie/simplepie/.travis.yml b/vendor/simplepie/simplepie/.travis.yml deleted file mode 100644 index e44352dbb..000000000 --- a/vendor/simplepie/simplepie/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - nightly - -matrix: - allow_failures: - # Allow failures for unstable builds. - - php: "nightly" - -before_script: - - | - if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then - travis_retry composer install --no-interaction --ignore-platform-reqs - else - travis_retry composer install --no-interaction - fi - -script: - - composer test - -branches: - except: - - one-dot-two diff --git a/vendor/simplepie/simplepie/CHANGELOG.md b/vendor/simplepie/simplepie/CHANGELOG.md index 60395f0f7..c9efdb476 100644 --- a/vendor/simplepie/simplepie/CHANGELOG.md +++ b/vendor/simplepie/simplepie/CHANGELOG.md @@ -1,10 +1,55 @@ -## 1.5.5 (May 1, 2020) +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased](https://github.com/simplepie/simplepie/compare/1.5.7...master) + +## [1.5.7](https://github.com/simplepie/simplepie/compare/1.5.6...1.5.7) - 2021-12-19 + +* Fix PHP8 crash due to insufficient isset test by @Alkarex in [#670](https://github.com/simplepie/simplepie/pull/670) +* gitignore tests by @Alkarex in [#671](https://github.com/simplepie/simplepie/pull/671) +* Reduce memory when parsing large feeds by @Alkarex in [#672](https://github.com/simplepie/simplepie/pull/672) +* PHP8 catch ValueError for loadHTML() by @Alkarex in [#673](https://github.com/simplepie/simplepie/pull/673) +* Provide access to HTTP status code by @Alkarex in [#674](https://github.com/simplepie/simplepie/pull/674) +* Fix wrong type hint by @Alkarex in [#678](https://github.com/simplepie/simplepie/pull/678) +* Force HTTPS for selected domains by @Alkarex in [#676](https://github.com/simplepie/simplepie/pull/676) +* Prevent cache polution by @Alkarex in [#675](https://github.com/simplepie/simplepie/pull/675) +* Fix typo in comment by @Alkarex in [#680](https://github.com/simplepie/simplepie/pull/680) +* Remove HTTP credentials in HTTP Referer by @Alkarex in [#681](https://github.com/simplepie/simplepie/pull/681) +* CI: switch to GH Actions by @jrfnl in [#688](https://github.com/simplepie/simplepie/pull/688) +* PHP 8.1: fix "passing null to non-nullable" deprecation notice by @jrfnl in [#689](https://github.com/simplepie/simplepie/pull/689) +* Tests: PHPUnit cross-version compatibility by @jrfnl in [#690](https://github.com/simplepie/simplepie/pull/690) +* Tests: use strict assertions by @jrfnl in [#692](https://github.com/simplepie/simplepie/pull/692) +* CacheTest: handle different exceptions PHP cross-version by @jrfnl in [#691](https://github.com/simplepie/simplepie/pull/691) +* GH Actions: don't allow builds to fail on PHP 8.0 or 8.1 by @jrfnl in [#693](https://github.com/simplepie/simplepie/pull/693) +* Tests: use the correct parameter order by @jrfnl in [#694](https://github.com/simplepie/simplepie/pull/694) +* PHPUnit: update configuration by @jrfnl in [#696](https://github.com/simplepie/simplepie/pull/696) +* fix: better deal with proxy returning proxy headers (in response to cURL's Proxy-Connection header) by @shunf4 in [#698](https://github.com/simplepie/simplepie/pull/698) +* Handle multiple Link headers by @voegelas in [#700](https://github.com/simplepie/simplepie/pull/700) +* PHP 8.2: explicitly declare properties by @jrfnl in [#705](https://github.com/simplepie/simplepie/pull/705) +* New Contributor: @shunf4 made their first contribution in [#698](https://github.com/simplepie/simplepie/pull/698) +* New Contributor: @voegelas made their first contribution in [#700](https://github.com/simplepie/simplepie/pull/700) + +## [1.5.6](https://github.com/simplepie/simplepie/compare/1.5.5...1.5.6) - 2020-10-14 + +* PHP 8.0: prevent ValueError for invalid encoding [#657](https://github.com/simplepie/simplepie/pull/657) +* Travis: test against more recent PHP versions [#653](https://github.com/simplepie/simplepie/pull/653) +* PHP 8.0: handle removal of get_magic_quotes_gpc() [#654](https://github.com/simplepie/simplepie/pull/654) +* PHP 7.4/8.0: curly brace array access deprecated & removed [#655](https://github.com/simplepie/simplepie/pull/655) +* PHP 8.0: required parameters are no longer allowed after optional parameters [#656](https://github.com/simplepie/simplepie/pull/656) +* Fix permanent_url for HTTP 301 [#660](https://github.com/simplepie/simplepie/pull/660) +* Fix typo in MIME type in Content_Type_Sniffer [#661](https://github.com/simplepie/simplepie/pull/661) + +## [1.5.5](https://github.com/simplepie/simplepie/compare/1.5.4...1.5.5) - 2020-05-01 * Ensure that feeds retrieved with `force_feed` do not share the same cache as those retrieved without. [#643](https://github.com/simplepie/simplepie/pull/643) * Removed references to removed PHP directives and some PHP < 5.6 checks. [#645](https://github.com/simplepie/simplepie/pull/645) * Corrected incorrect alumni name. [#638](https://github.com/simplepie/simplepie/pull/638) -## 1.5.4 (December 17, 2019) +## [1.5.4](https://github.com/simplepie/simplepie/compare/1.5.3...1.5.4) - 2019-12-17 * PHP 5.6 or newer is now required. [#625](https://github.com/simplepie/simplepie/pull/625) * Fixed invalid docblock parameter types [#633](https://github.com/simplepie/simplepie/pull/633) @@ -12,7 +57,7 @@ * PHP 7.4 support: Fixed instances of accessing array offset on null type values. [#628](https://github.com/simplepie/simplepie/pull/628) * Return an effective feed URL when asking for non-permanent `subscribe_url`. [#627](https://github.com/simplepie/simplepie/pull/627) -## 1.5.3 (September 22, 2019) +## [1.5.3](https://github.com/simplepie/simplepie/compare/1.5.2...1.5.3) - 2019-09-22 * Replaced `pow()` call with `**` operator (micro performance optimization). [#622](https://github.com/simplepie/simplepie/pull/622) * Match links containing `feed` in the Locator class. [#621](https://github.com/simplepie/simplepie/pull/621) @@ -20,7 +65,7 @@ * Added support for Russian dates. [#607](https://github.com/simplepie/simplepie/pull/607) * Preemptively changed `is_writeable()` calls to `is_writable()` in case the former is deprecated in PHP. [#604](https://github.com/simplepie/simplepie/pull/604) -## 1.5.2 (August 2, 2018) +## [1.5.2](https://github.com/simplepie/simplepie/compare/1.5.1...1.5.2) - 2018-08-02 * Added support for PHPUnit 6. [#565](https://github.com/simplepie/simplepie/pull/565) * Added PHP module requirements to Composer. [#590](https://github.com/simplepie/simplepie/pull/590) @@ -35,7 +80,7 @@ * Fixed a bug where URL fragments are included when `SimplePie_File` normalizes URLs when really old versions of cURL are used. [#564](https://github.com/simplepie/simplepie/pull/564) * Updated `SimplePie_Locator` to respect cURL options specified. [#561](https://github.com/simplepie/simplepie/pull/561) -## 1.5.1 (November 17, 2017) +## [1.5.1](https://github.com/simplepie/simplepie/compare/1.5...1.5.1) - 2017-11-17 * Fixed photos so they are not added if the URL is empty. [#530](https://github.com/simplepie/simplepie/pull/530) * Fixed issues with retrieving feeds from behind a proxy. [#512](https://github.com/simplepie/simplepie/pull/512)/[#548](https://github.com/simplepie/simplepie/pull/548) @@ -48,14 +93,14 @@ * Update the registry if the Sanitize class has been changed. [#532](https://github.com/simplepie/simplepie/pull/532) * Changed the sanitization type for author and category back to text from HTML. [#531](https://github.com/simplepie/simplepie/pull/531) -## 1.5 (April 17, 2017) +## [1.5](https://github.com/simplepie/simplepie/compare/1.4.3...1.5) - 2017-04-17 * Introduced `SimplePie_Category->get_type()` for retrieving category type. [#492](https://github.com/simplepie/simplepie/pull/492) * Added `$enable_exceptions` to the class property declarations for `SimplePie` class. [#504](https://github.com/simplepie/simplepie/pull/504) * Titles are now parsed for ATOM10 enclosure links. [#507](https://github.com/simplepie/simplepie/pull/507) * `$item->get_id()` can now be forced to return the supplied ID instead of generating a new one. [#509](https://github.com/simplepie/simplepie/pull/509) -## 1.4.3 (November 26, 2016) +## [1.4.3](https://github.com/simplepie/simplepie/compare/1.4.2...1.4.3) - 2016-11-26 * Removed support for PHP 5.2. [#469](https://github.com/simplepie/simplepie/pull/469) * Added support for the PHP `UConverter` class. [#485](https://github.com/simplepie/simplepie/pull/485) @@ -76,18 +121,18 @@ * Fixed misspelled occurrences of "separated". [#459](https://github.com/simplepie/simplepie/pull/459) * Improvements to the compatibility test and error messages. [#488](https://github.com/simplepie/simplepie/pull/488) -## 1.4.2 (June 14, 2016) +## [1.4.2](https://github.com/simplepie/simplepie/compare/1.4.1...1.4.2) - 2016-06-14 * Fixed a bug with IRI parsing. * More cleanly separates discovery of microformats and parsing when php-mf2 is not present. -## 1.4.1 (June 2, 2016) +## [1.4.1](https://github.com/simplepie/simplepie/compare/1.4.0...1.4.1) - 2016-06-02 * Fixed inconsistent hash results in `SimplePie_Item->get_id()`. * Leading and trailing whitespace is now trimmed from XML feed content to prevent errors. [#445](https://github.com/simplepie/simplepie/pull/445) * Improved support for microformat feeds. -## 1.4.0 (April 25, 2016) +## [1.4.0](https://github.com/simplepie/simplepie/compare/1.4-beta...1.4.0) - 2016-04-25 * Dropped support for PHP 5.2. [#348](https://github.com/simplepie/simplepie/pull/348) * Serialized data is now used for hashing in `SimplePie_Item->get_id()`. [#348](https://github.com/simplepie/simplepie/pull/348) diff --git a/vendor/simplepie/simplepie/autoloader.php b/vendor/simplepie/simplepie/autoloader.php index e42f07b3a..bf34a7003 100644 --- a/vendor/simplepie/simplepie/autoloader.php +++ b/vendor/simplepie/simplepie/autoloader.php @@ -58,6 +58,8 @@ if (!class_exists('SimplePie')) */ class SimplePie_Autoloader { + protected $path; + /** * Constructor */ diff --git a/vendor/simplepie/simplepie/composer.json b/vendor/simplepie/simplepie/composer.json index d76ee7d4d..83efa2d82 100644 --- a/vendor/simplepie/simplepie/composer.json +++ b/vendor/simplepie/simplepie/composer.json @@ -30,7 +30,7 @@ "ext-xmlreader": "*" }, "require-dev": { - "phpunit/phpunit": "~5.4.3 || ~6.5" + "yoast/phpunit-polyfills": "^1.0.1" }, "suggest": { "ext-curl": "", diff --git a/vendor/simplepie/simplepie/library/SimplePie.php b/vendor/simplepie/simplepie/library/SimplePie.php old mode 100644 new mode 100755 index a6a5a9e13..29c8ece01 --- a/vendor/simplepie/simplepie/library/SimplePie.php +++ b/vendor/simplepie/simplepie/library/SimplePie.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.5.6 + * @version 1.5.8 * @copyright 2004-2017 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman * @author Sam Sneddon @@ -50,7 +50,7 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.5.6'); +define('SIMPLEPIE_VERSION', '1.5.8'); /** * SimplePie Build @@ -424,6 +424,13 @@ class SimplePie */ public $error; + /** + * @var int HTTP status code + * @see SimplePie::status_code() + * @access private + */ + public $status_code; + /** * @var object Instance of SimplePie_Sanitize (or other class) * @see SimplePie::set_sanitize_class() @@ -908,6 +915,39 @@ class SimplePie $this->cache_location = (string) $location; } + /** + * Return the filename (i.e. hash, without path and without extension) of the file to cache a given URL. + * @param string $url The URL of the feed to be cached. + * @return string A filename (i.e. hash, without path and without extension). + */ + public function get_cache_filename($url) + { + // Append custom parameters to the URL to avoid cache pollution in case of multiple calls with different parameters. + $url .= $this->force_feed ? '#force_feed' : ''; + $options = array(); + if ($this->timeout != 10) + { + $options[CURLOPT_TIMEOUT] = $this->timeout; + } + if ($this->useragent !== SIMPLEPIE_USERAGENT) + { + $options[CURLOPT_USERAGENT] = $this->useragent; + } + if (!empty($this->curl_options)) + { + foreach ($this->curl_options as $k => $v) + { + $options[$k] = $v; + } + } + if (!empty($options)) + { + ksort($options); + $url .= '#' . urlencode(var_export($options, true)); + } + return call_user_func($this->cache_name_function, $url); + } + /** * Set whether feed items should be sorted into reverse chronological order * @@ -1146,6 +1186,7 @@ class SimplePie $this->strip_attributes(false); $this->add_attributes(false); $this->set_image_handler(false); + $this->set_https_domains(array()); } } @@ -1248,6 +1289,19 @@ class SimplePie $this->sanitize->set_url_replacements($element_attribute); } + /** + * Set the list of domains for which to force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * @param array List of HTTPS domains. Example array('biz', 'example.com', 'example.org', 'www.example.net'). + */ + public function set_https_domains($domains = array()) + { + if (is_array($domains)) + { + $this->sanitize->set_https_domains($domains); + } + } + /** * Set the handler to enable the display of cached images. * @@ -1373,8 +1427,8 @@ class SimplePie // Decide whether to enable caching if ($this->cache && $parsed_feed_url['scheme'] !== '') { - $url = $this->feed_url . ($this->force_feed ? '#force_feed' : ''); - $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $url), 'spc')); + $filename = $this->get_cache_filename($this->feed_url); + $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $filename, 'spc')); } // Fetch the data via SimplePie_File into $this->raw_data @@ -1514,7 +1568,7 @@ class SimplePie * Fetch the data via SimplePie_File * * If the data is already cached, attempt to fetch it from there instead - * @param SimplePie_Cache|false $cache Cache handler, or false to not load from the cache + * @param SimplePie_Cache_Base|false $cache Cache handler, or false to not load from the cache * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type */ protected function fetch_data(&$cache) @@ -1577,6 +1631,7 @@ class SimplePie } $file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); + $this->status_code = $file->status_code; if ($file->success) { @@ -1631,6 +1686,8 @@ class SimplePie $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); } } + $this->status_code = $file->status_code; + // If the file connection has an error, set SimplePie::error to that and quit if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { @@ -1728,7 +1785,7 @@ class SimplePie } /** - * Get the error message for the occured error + * Get the error message for the occurred error * * @return string|array Error message, or array of messages for multifeeds */ @@ -1737,6 +1794,16 @@ class SimplePie return $this->error; } + /** + * Get the last HTTP status code + * + * @return int Status code + */ + public function status_code() + { + return $this->status_code; + } + /** * Get the raw XML * @@ -2580,13 +2647,19 @@ class SimplePie } } - if (isset($this->data['headers']['link']) && - preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', - $this->data['headers']['link'], $match)) + if (isset($this->data['headers']['link'])) { - return array($match[1]); + $link_headers = $this->data['headers']['link']; + if (is_string($link_headers)) { + $link_headers = array($link_headers); + } + $matches = preg_filter('/<([^>]+)>; rel='.preg_quote($rel).'/', '$1', $link_headers); + if (!empty($matches)) { + return $matches; + } } - else if (isset($this->data['links'][$rel])) + + if (isset($this->data['links'][$rel])) { return $this->data['links'][$rel]; } diff --git a/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php b/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php old mode 100644 new mode 100755 diff --git a/vendor/simplepie/simplepie/library/SimplePie/Cache/Redis.php b/vendor/simplepie/simplepie/library/SimplePie/Cache/Redis.php index dbc88e829..a5925bec2 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Cache/Redis.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Cache/Redis.php @@ -152,7 +152,7 @@ class SimplePie_Cache_Redis implements SimplePie_Cache_Base { if ($data !== false) { $return = $this->cache->set($this->name, $data); if ($this->options['expire']) { - return $this->cache->expire($this->name, $this->ttl); + return $this->cache->expire($this->name, $this->options['expire']); } return $return; } diff --git a/vendor/simplepie/simplepie/library/SimplePie/Enclosure.php b/vendor/simplepie/simplepie/library/SimplePie/Enclosure.php index 32216d848..8a4cffa30 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Enclosure.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Enclosure.php @@ -1152,7 +1152,12 @@ class SimplePie_Enclosure // If we encounter an unsupported mime-type, check the file extension and guess intelligently. if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) { - switch (strtolower($this->get_extension())) + $extension = $this->get_extension(); + if ($extension === null) { + return null; + } + + switch (strtolower($extension)) { // Audio mime-types case 'aac': diff --git a/vendor/simplepie/simplepie/library/SimplePie/File.php b/vendor/simplepie/simplepie/library/SimplePie/File.php index 90ad8196a..c2d368b3b 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/File.php +++ b/vendor/simplepie/simplepie/library/SimplePie/File.php @@ -106,7 +106,7 @@ class SimplePie_File curl_setopt($fp, CURLOPT_FAILONERROR, 1); curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); - curl_setopt($fp, CURLOPT_REFERER, $url); + curl_setopt($fp, CURLOPT_REFERER, SimplePie_Misc::url_remove_credentials($url)); curl_setopt($fp, CURLOPT_USERAGENT, $useragent); curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); foreach ($curl_options as $curl_param => $curl_value) { @@ -119,6 +119,7 @@ class SimplePie_File curl_setopt($fp, CURLOPT_ENCODING, 'none'); $this->headers = curl_exec($fp); } + $this->status_code = curl_getinfo($fp, CURLINFO_HTTP_CODE); if (curl_errno($fp)) { $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp); diff --git a/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php b/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php index 1dbe06c3e..a4c48ddb7 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php +++ b/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php @@ -507,11 +507,13 @@ class SimplePie_HTTP_Parser { $data = explode("\r\n\r\n", $headers, $count); $data = array_pop($data); - if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n\r\n")) { - $data = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $data); + if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n")) { + $exploded = explode("\r\n\r\n", $data, 2); + $data = end($exploded); } - if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n\r\n")) { - $data = str_ireplace("HTTP/1.1 200 Connection established\r\n\r\n", '', $data); + if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n")) { + $exploded = explode("\r\n\r\n", $data, 2); + $data = end($exploded); } return $data; } diff --git a/vendor/simplepie/simplepie/library/SimplePie/Item.php b/vendor/simplepie/simplepie/library/SimplePie/Item.php index 5be6b1994..3ac4fa882 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Item.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Item.php @@ -1803,7 +1803,7 @@ class SimplePie_Item } if (isset($content['attribs']['']['fileSize'])) { - $length = ceil($content['attribs']['']['fileSize']); + $length = intval($content['attribs']['']['fileSize']); } if (isset($content['attribs']['']['medium'])) { @@ -2425,7 +2425,7 @@ class SimplePie_Item } if (isset($content['attribs']['']['fileSize'])) { - $length = ceil($content['attribs']['']['fileSize']); + $length = intval($content['attribs']['']['fileSize']); } if (isset($content['attribs']['']['medium'])) { @@ -2790,7 +2790,7 @@ class SimplePie_Item } if (isset($link['attribs']['']['length'])) { - $length = ceil($link['attribs']['']['length']); + $length = intval($link['attribs']['']['length']); } if (isset($link['attribs']['']['title'])) { @@ -2833,7 +2833,7 @@ class SimplePie_Item } if (isset($link['attribs']['']['length'])) { - $length = ceil($link['attribs']['']['length']); + $length = intval($link['attribs']['']['length']); } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor @@ -2862,13 +2862,14 @@ class SimplePie_Item $width = null; $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0])); + $url = $this->feed->sanitize->https_url($url); if (isset($enclosure[0]['attribs']['']['type'])) { $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($enclosure[0]['attribs']['']['length'])) { - $length = ceil($enclosure[0]['attribs']['']['length']); + $length = intval($enclosure[0]['attribs']['']['length']); } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor diff --git a/vendor/simplepie/simplepie/library/SimplePie/Locator.php b/vendor/simplepie/simplepie/library/SimplePie/Locator.php index a207df6fe..c5fae0579 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Locator.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Locator.php @@ -64,6 +64,7 @@ class SimplePie_Locator var $max_checked_feeds = 10; var $force_fsockopen = false; var $curl_options = array(); + var $dom; protected $registry; public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10, $force_fsockopen = false, $curl_options = array()) @@ -75,12 +76,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 diff --git a/vendor/simplepie/simplepie/library/SimplePie/Misc.php b/vendor/simplepie/simplepie/library/SimplePie/Misc.php index a52498ac7..ce3cf0f54 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Misc.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Misc.php @@ -2260,4 +2260,14 @@ function embed_wmedia(width, height, link) { { // No-op } + + /** + * Sanitize a URL by removing HTTP credentials. + * @param string $url the URL to sanitize. + * @return string the same URL without HTTP credentials. + */ + public static function url_remove_credentials($url) + { + return preg_replace('#^(https?://)[^/:@]+:[^/:@]+@#i', '$1', $url); + } } diff --git a/vendor/simplepie/simplepie/library/SimplePie/Parser.php b/vendor/simplepie/simplepie/library/SimplePie/Parser.php index 4efdf41a7..3813b74b2 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Parser.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Parser.php @@ -164,12 +164,30 @@ class SimplePie_Parser xml_set_element_handler($xml, 'tag_open', 'tag_close'); // Parse! - if (!xml_parse($xml, $data, true)) + $wrapper = @is_writable(sys_get_temp_dir()) ? 'php://temp' : 'php://memory'; + if (($stream = fopen($wrapper, 'r+')) && + fwrite($stream, $data) && + rewind($stream)) + { + //Parse by chunks not to use too much memory + do + { + $stream_data = fread($stream, 1048576); + if (!xml_parse($xml, $stream_data === false ? '' : $stream_data, feof($stream))) + { + $this->error_code = xml_get_error_code($xml); + $this->error_string = xml_error_string($this->error_code); + $return = false; + break; + } + } while (!feof($stream)); + fclose($stream); + } + else { - $this->error_code = xml_get_error_code($xml); - $this->error_string = xml_error_string($this->error_code); $return = false; } + $this->current_line = xml_get_current_line_number($xml); $this->current_column = xml_get_current_column_number($xml); $this->current_byte = xml_get_current_byte_index($xml); diff --git a/vendor/simplepie/simplepie/library/SimplePie/Registry.php b/vendor/simplepie/simplepie/library/SimplePie/Registry.php old mode 100644 new mode 100755 index bf3baf179..1aac51d07 --- a/vendor/simplepie/simplepie/library/SimplePie/Registry.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Registry.php @@ -208,7 +208,8 @@ class SimplePie_Registry { case 'Cache': // For backwards compatibility with old non-static - // Cache::create() methods + // Cache::create() methods in PHP < 8.0. + // No longer supported as of PHP 8.0. if ($method === 'get_handler') { $result = @call_user_func_array(array($class, 'create'), $parameters); diff --git a/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php b/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php index 35838032f..d421c8307 100644 --- a/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php +++ b/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php @@ -71,6 +71,15 @@ class SimplePie_Sanitize var $useragent = ''; var $force_fsockopen = false; var $replace_url_attributes = null; + var $registry; + + /** + * List of domains for which to force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * Array is a tree split at DNS levels. Example: + * array('biz' => true, 'com' => array('example' => true), 'net' => array('example' => array('www' => true))) + */ + var $https_domains = array(); public function __construct() { @@ -241,6 +250,68 @@ class SimplePie_Sanitize $this->replace_url_attributes = (array) $element_attribute; } + /** + * Set the list of domains for which to force HTTPS. + * @see SimplePie_Misc::https_url() + * Example array('biz', 'example.com', 'example.org', 'www.example.net'); + */ + public function set_https_domains($domains) + { + $this->https_domains = array(); + foreach ($domains as $domain) + { + $domain = trim($domain, ". \t\n\r\0\x0B"); + $segments = array_reverse(explode('.', $domain)); + $node =& $this->https_domains; + foreach ($segments as $segment) + {//Build a tree + if ($node === true) + { + break; + } + if (!isset($node[$segment])) + { + $node[$segment] = array(); + } + $node =& $node[$segment]; + } + $node = true; + } + } + + /** + * Check if the domain is in the list of forced HTTPS. + */ + protected function is_https_domain($domain) + { + $domain = trim($domain, '. '); + $segments = array_reverse(explode('.', $domain)); + $node =& $this->https_domains; + foreach ($segments as $segment) + {//Explore the tree + if (isset($node[$segment])) + { + $node =& $node[$segment]; + } + else + { + break; + } + } + return $node === true; + } + + /** + * Force HTTPS for selected Web sites. + */ + public function https_url($url) + { + return (strtolower(substr($url, 0, 7)) === 'http://') && + $this->is_https_domain(parse_url($url, PHP_URL_HOST)) ? + substr_replace($url, 's', 4, 0) : //Add the 's' to HTTPS + $url; + } + public function sanitize($data, $type, $base = '') { $data = trim($data); @@ -443,6 +514,7 @@ class SimplePie_Sanitize $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base)); if ($value !== false) { + $value = $this->https_url($value); $element->setAttribute($attribute, $value); } } -- cgit v1.2.3