Add __unserialize() magic method to prevent PHP 8.5 deprecation warnings#9916
Add __unserialize() magic method to prevent PHP 8.5 deprecation warnings#9916USERSATOSHI wants to merge 5 commits intoWordPress:trunkfrom
__unserialize() magic method to prevent PHP 8.5 deprecation warnings#9916Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
What's with the failing tests? |
| } | ||
|
|
||
| public function __wakeup() { | ||
| public function __unserialize( $data ) { |
There was a problem hiding this comment.
Requests library needs to be fixed upstream first
There was a problem hiding this comment.
I checked the upstream issue on Request Library and this comment WordPress/Requests#949 (comment) mentioned that the fix is needed to be applied here.
There was a problem hiding this comment.
Yes, for now, this should be fixed directly in Core. According to this comment, Requests 2.1.0 will fix the originally patched issue (which introduced the __wakeup call) differently, so that both the __wakeup and __unserialize can then be removed.
There was a problem hiding this comment.
No need to change this old class AFAICT
There was a problem hiding this comment.
Got it, I will remove for this file
There was a problem hiding this comment.
This file has been fixed upstream, see https://core.trac.wordpress.org/ticket/64008.
checking the error it seems like |
dmsnell
left a comment
There was a problem hiding this comment.
Thanks for this update, I appreciate you keeping the __wakeup() methods for compatibility. From the HTML API perspective this looks fine.
| // Do nothing. | ||
| } | ||
| } No newline at end of file | ||
| } |
There was a problem hiding this comment.
These edits seem unrelated. If we have a problem with the no-op comment, that might be best addressed in a separate ticket. I suspect this is left-over from removing other edits, but the newline at the end and the comment changes are still here.
There was a problem hiding this comment.
got it, I have discarded the changes.
|
This should please be reopened as it still contains changes that need to be committed. |
This PR adds
__unserialize()implementations across WordPress core classes to address PHP 8.5 deprecation of__wakeup(). The new methods mirror existing__wakeup()behavior - either throwingLogicExceptionfor classes that shouldn't be unserialized, or performing validation/cleanup for classes that can be safely restored.__wakeup()methods are kept as wrappers calling the same logic as__unserialize().Trac ticket: https://core.trac.wordpress.org/ticket/63962
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.