Skip to content

[1.8] Backport PHP 8.4 compat fixes#875

Merged
jtojnar merged 6 commits intosimplepie:one-dot-eightfrom
jtojnar:backports
Sep 25, 2024
Merged

[1.8] Backport PHP 8.4 compat fixes#875
jtojnar merged 6 commits intosimplepie:one-dot-eightfrom
jtojnar:backports

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Aug 27, 2024

No description provided.

jtojnar and others added 2 commits August 27, 2024 23:45
As per PHP docs, the XML functions also accept just a method name as a string,
even though it is not actually a callable:

    Note: Instead of a function name, an array containing an object reference and a method name can also be supplied.

PHPStan level 5 will complain though:

    Parameter simplepie#2 $handler of function xml_set_character_data_handler expects callable(): mixed, 'cdata' given.

Let’s use proper callables.

(cherry picked from commit f5c99dd)

This is deprecated in PHP 8.4.
(cherry picked from commit 6d40e1b)

This is deprecated in PHP 8.4.
@jrfnl
Copy link
Contributor

jrfnl commented Sep 12, 2024

This will also need the fixes from PRs #880 and #881.

@jtojnar
Copy link
Member Author

jtojnar commented Sep 25, 2024

Cherry picked the latter, the former is not relevant as there are no typehints in this branch.

PHP 8.4 deprecates passing `E_USER_ERROR` to `trigger_error()`, with the recommendation being to replace these type of calls with either an Exception or an `exit` statement.

This commit fixes an instance found in the autoloader by changing it to a call to `exit`, which considering it is an error related to the autoloader not being registered seems the most appropriate.

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
(cherry picked from commit 926974a)
PHP 8.4 deprecates passing `E_USER_ERROR` to `trigger_error()`, with the recommendation being to replace these type of calls with either an Exception or an `exit` statement.

This commit fixes another instance of this issue. In this case, the call to `trigger_error()` is replaced by throwing a generic `SimplePie\Exception` for the same.

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
(cherry picked from commit 24786a7)
PHP 8.4 deprecates passing `E_USER_ERROR` to `trigger_error()`, with the recommendation being to replace these type of calls with either an Exception or an `exit` statement.

This commit fixes the last instance of this issue. In this case, the call to `trigger_error()` is also replaced by throwing a generic `SimplePie\Exception` for the same.

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
(cherry picked from commit 7f2fd6c)
... the call to `trigger_error()` would now throw a PHP notice, but with the `die()` after it, with still kill the program anyhow, so we may as well, exit with the error message and remove the `trigger_error()` function call completely.

(cherry picked from commit 2a05361)
@jtojnar jtojnar force-pushed the backports branch 2 times, most recently from 28ec26a to 35f0278 Compare September 25, 2024 19:57
@jtojnar
Copy link
Member Author

jtojnar commented Sep 25, 2024

@Art4 If there are no other critical changes to backport, I propose merging this and then tagging 1.8.1.

We can make 1.8.2 with the other fixes like #883 later.

@Art4
Copy link
Contributor

Art4 commented Sep 25, 2024

@jtojnar I'm fine with releasing 1.8.1. Will you create the PR?

Update: Oh, I see you would like to create 1.8.1 from this PR? I would recommend to move commit 35f0278 into a separate PR. There we can update the version constant too.

@jtojnar jtojnar force-pushed the backports branch 2 times, most recently from 1c7f003 to c5d5187 Compare September 25, 2024 20:20
@jtojnar jtojnar merged commit c5d5187 into simplepie:one-dot-eight Sep 25, 2024
@jtojnar jtojnar deleted the backports branch September 25, 2024 20:20
@jtojnar
Copy link
Member Author

jtojnar commented Sep 25, 2024

Okay, opened #886 and moved the chnagelog + constant there.

@jrfnl
Copy link
Contributor

jrfnl commented Sep 26, 2024

Cherry picked the latter, the former is not relevant as there are no typehints in this branch.

Sorry to correct you, but you're wrong. The IRI class may not have type declarations in 1.8, the Sanitize class does and the PHP 8.4 fix for that will need a backport.

public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', DataCache $cache = null)

-    public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', DataCache $cache = null)
+    public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', ?DataCache $cache = null)

Unless this change is backported, you'll have 998 failing tests on PHP 8.4 for the SimplePie 1.8 branch.

@jrfnl jrfnl mentioned this pull request Sep 26, 2024
4 tasks
@jtojnar
Copy link
Member Author

jtojnar commented Sep 26, 2024

Oops, I did not scroll far enough in merge conflict resolution.

Opened #888

@Art4 Art4 added this to the 1.8.1 milestone Sep 30, 2024
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Sep 30, 2024
The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([simplepie/simplepie#875 PR 875], [simplepie/simplepie#888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [simplepie/simplepie#886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [simplepie/simplepie@1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.

git-svn-id: https://develop.svn.wordpress.org/trunk@59141 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Sep 30, 2024
The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([simplepie/simplepie#875 PR 875], [simplepie/simplepie#888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [simplepie/simplepie#886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [simplepie/simplepie@1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.
Built from https://develop.svn.wordpress.org/trunk@59141


git-svn-id: http://core.svn.wordpress.org/trunk@58537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Sep 30, 2024
The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([simplepie/simplepie#875 PR 875], [simplepie/simplepie#888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [simplepie/simplepie#886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [simplepie/simplepie@1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.
Built from https://develop.svn.wordpress.org/trunk@59141


git-svn-id: https://core.svn.wordpress.org/trunk@58537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
mattyrob pushed a commit to ClassicPress/ClassicPress that referenced this pull request Oct 1, 2024
…n 1.8.0.

The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([simplepie/simplepie#875 PR 875], [simplepie/simplepie#888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [simplepie/simplepie#886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [simplepie/simplepie@1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to https://core.trac.wordpress.org/changeset/47733, https://core.trac.wordpress.org/changeset/49176, https://core.trac.wordpress.org/changeset/52393, https://core.trac.wordpress.org/changeset/52413.

WP:Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See https://core.trac.wordpress.org/ticket/55604.

Conflicts:
- src/wp-includes/class-simplepie.php
- src/wp-includes/class-wp-simplepie-file.php

---

Merges https://core.trac.wordpress.org/changeset/59141 / WordPress/wordpress-develop@ebfb7649ca to ClassicPress.
aslamdoctor pushed a commit to aslamdoctor/wordpress-develop that referenced this pull request Dec 28, 2024
The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([simplepie/simplepie#875 PR 875], [simplepie/simplepie#888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [simplepie/simplepie#886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [simplepie/simplepie@1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.

git-svn-id: https://develop.svn.wordpress.org/trunk@59141 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants