From 37dcd65d71a7bb5153f33f487b50f81612b06686 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 1 Oct 2024 10:44:18 +0200 Subject: [PATCH 1/5] Misc: Deprecate percent_encoding_normalization This is unused since d70e841927072a2e0f810dffc761fc2cd60af1f9. --- CHANGELOG.md | 1 + src/Misc.php | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b3dc9df..3dd38258a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +- The method `SimplePie\Misc::percent_encoding_normalization()` is deprecated. If you need it, consider copying the function to your codebase. (by @jtojnar in [#895](https://github.com/simplepie/simplepie/pull/895)) - 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)) diff --git a/src/Misc.php b/src/Misc.php index 7225c15e6..bb20a2ece 100644 --- a/src/Misc.php +++ b/src/Misc.php @@ -250,6 +250,7 @@ public static function normalize_url(string $url) } /** + * @deprecated since SimplePie 1.9.0. This functionality is part of `IRI` – if you need it standalone, consider copying the function to your codebase. * @param array $match * @return string */ From 51952bc76390e7c025b8e7583905c81f7665ca45 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 1 Oct 2024 22:27:51 +0200 Subject: [PATCH 2/5] Misc: Deprecate element_implode This is remnant of parsing HTML with regex, not used since 878c83cc937419364cac3926361b7d996f7b0cb4 --- CHANGELOG.md | 6 +++++- src/Misc.php | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dd38258a..d180b087a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated -- The method `SimplePie\Misc::percent_encoding_normalization()` is deprecated. If you need it, consider copying the function to your codebase. (by @jtojnar in [#895](https://github.com/simplepie/simplepie/pull/895)) +- The following `SimplePie\Misc` methods are deprecated without replacement: + - `SimplePie\Misc::element_implode()` + - `SimplePie\Misc::percent_encoding_normalization()` + + If you need any of them, consider copying the function to your codebase. (by @jtojnar in [#899](https://github.com/simplepie/simplepie/pull/899)) - 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)) diff --git a/src/Misc.php b/src/Misc.php index bb20a2ece..6eff0ab2b 100644 --- a/src/Misc.php +++ b/src/Misc.php @@ -105,11 +105,14 @@ public static function get_element(string $realname, string $string) } /** + * @deprecated since SimplePie 1.9.0. If you need it, you can copy the function to your codebase. But you should consider using `DOMDocument` for any DOM wrangling. * @param array{tag: string, self_closing: bool, attribs: array, content: string} $element * @return string */ public static function element_implode(array $element) { + // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED); + $full = "<{$element['tag']}"; foreach ($element['attribs'] as $key => $value) { $key = strtolower($key); From 70196497acef1afc0f1494eb0b0017c50f91a238 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 1 Oct 2024 22:31:24 +0200 Subject: [PATCH 3/5] Misc: Deprecate strip_comments Yet another remnant of parsing HTML with regex, not used since 878c83cc937419364cac3926361b7d996f7b0cb4 --- CHANGELOG.md | 1 + src/Misc.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d180b087a..a509c81bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The following `SimplePie\Misc` methods are deprecated without replacement: - `SimplePie\Misc::element_implode()` - `SimplePie\Misc::percent_encoding_normalization()` + - `SimplePie\Misc::strip_comments()` If you need any of them, consider copying the function to your codebase. (by @jtojnar in [#899](https://github.com/simplepie/simplepie/pull/899)) - The method `SimplePie\SimplePie::set_file()` is deprecated, use `SimplePie\SimplePie::set_http_client()` or `SimplePie\SimplePie::set_raw_data()` instead diff --git a/src/Misc.php b/src/Misc.php index 6eff0ab2b..7fa206c71 100644 --- a/src/Misc.php +++ b/src/Misc.php @@ -1716,11 +1716,14 @@ public static function get_curl_version() /** * Strip HTML comments * + * @deprecated since SimplePie 1.9.0. If you need it, you can copy the function to your codebase. But you should consider using `DOMDocument` for any DOM wrangling. * @param string $data Data to strip comments from * @return string Comment stripped string */ public static function strip_comments(string $data) { + // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED); + $output = ''; while (($start = strpos($data, '