Skip to content

Commit

Permalink
Merge branch 'master' into merge-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex committed Dec 5, 2024
2 parents 88f13f2 + 72b4293 commit 4fbc790
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 27 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
- '8.4'

name: "PHP: ${{ matrix.php }}"
continue-on-error: ${{ matrix.php == '8.4' }}

steps:
- name: Checkout code
Expand All @@ -71,15 +70,8 @@ jobs:

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: "Install Composer dependencies (PHP < 8.4)"
if: ${{ matrix.php < '8.4' }}
uses: "ramsey/composer-install@v2"

- name: "Install Composer dependencies (PHP 8.4)"
if: ${{ matrix.php >= '8.4' }}
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs

- name: Run unit tests
run: composer test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SimplePie.compiled.php
bin/
vendor/
composer.lock
phpstan.neon
phpunit.xml
.php-cs-fixer.cache
.phpunit.cache/
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Use `idn_to_ascii` function instead of `idna_convert` library (requires `intl` extension or a [polyfill](https://github.com/symfony/polyfill-intl-idn)) by @jtojnar in [#785](https://github.com/simplepie/simplepie/pull/785)
- Use native `gzdecode` function instead of internal PHP implementation by @jtojnar in [#882](https://github.com/simplepie/simplepie/pull/882)

### Removed

Expand All @@ -26,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The method `SimplePie\SimplePie::set_file()` is deprecated, use `SimplePie\SimplePie::set_http_client()` or `SimplePie\SimplePie::set_raw_data()` instead
- The method `SimplePie\Sanitize::pass_file_data()` is deprecated, use `SimplePie\Sanitize::set_http_client()` instead
- Passing multiple URLs to `SimplePie\SimplePie::set_feed_url()` is deprecated. You can create separate `SimplePie` instance per feed and then use `SimplePie::merge_items()` to get a single list of items. ([#795](https://github.com/simplepie/simplepie/pull/795))
- The `SimplePie\Gzdecode` class is deprecated. You can use native [`gzdecode`](https://www.php.net/manual/en/function.gzdecode.php) function by @jtojnar in [#882](https://github.com/simplepie/simplepie/pull/882)

## [1.8.0](https://github.com/simplepie/simplepie/compare/1.7.0...1.8.0) - 2023-01-20

Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,11 @@ public function __construct(string $url, int $timeout = 10, int $redirects = 5,
switch (strtolower(trim($contentEncodingHeader, "\x09\x0A\x0D\x20"))) {
case 'gzip':
case 'x-gzip':
$decoder = new \SimplePie\Gzdecode($this->body);
if (!$decoder->parse()) {
if (($decompressed = gzdecode($this->body)) === false) {
$this->error = 'Unable to decode HTTP "gzip" stream';
$this->success = false;
} else {
$this->body = trim($decoder->data);
$this->body = trim($decompressed);
}
break;

Expand All @@ -250,7 +249,7 @@ public function __construct(string $url, int $timeout = 10, int $redirects = 5,
$this->body = $decompressed;
} elseif (($decompressed = gzuncompress($this->body)) !== false) {
$this->body = $decompressed;
} elseif (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false) {
} elseif (($decompressed = gzdecode($this->body)) !== false) {
$this->body = $decompressed;
} else {
$this->error = 'Unable to decode HTTP "deflate" stream';
Expand Down
2 changes: 2 additions & 0 deletions src/Gzdecode.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* Decode 'gzip' encoded HTTP data
*
* @link http://www.gzip.org/format.txt
* @link https://www.php.net/manual/en/function.gzdecode.php
* @deprecated since SimplePie 1.9.0, use `gzdecode` function instead.
*/
class Gzdecode
{
Expand Down
17 changes: 4 additions & 13 deletions src/IRI.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,10 @@ public static function absolutize($base, $relative)
protected function parse_iri(string $iri)
{
$iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match)) {
if ($match[1] === '') {
$match['scheme'] = null;
}
if ($match[3] === '') {
$match['authority'] = null;
}
if (!isset($match[6]) || $match[6] === '') {
$match['query'] = null;
}
if (!isset($match[8]) || $match[8] === '') {
$match['fragment'] = null;
}
if (preg_match('/^(?:(?P<scheme>[^:\/?#]+):)?(:?\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(?:\?(?P<query>[^#]*))?(?:#(?P<fragment>.*))?$/', $iri, $match, \PREG_UNMATCHED_AS_NULL)) {
// TODO: Remove once we require PHP ≥ 7.4.
$match['query'] = $match['query'] ?? null;
$match['fragment'] = $match['fragment'] ?? null;
return $match;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SimplePie.php
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ public function strip_htmltags($tags = '', ?bool $encode = null)
}
$this->sanitize->strip_htmltags($tags);
if ($encode !== null) {
$this->sanitize->encode_instead_of_strip($tags);
$this->sanitize->encode_instead_of_strip($encode);
}
}

Expand Down

0 comments on commit 4fbc790

Please sign in to comment.