-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Upgrade/Install: Return an WP_Error
when files cannot be detected.
#7558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
WP_Error
object when no source files can be detected.WP_Error
when no source files can be detected.
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. |
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. |
I see that this is currently milestoned for WordPress 6.7. While I totally agree that this can have a serious impact, this doesn't leave a lot of time for testing. The added unit tests certainly help, just be mindful of our timeframe here and the need to be confident that the error handling is safe through testing. If this PR has consensus as the way we're going forward here, then we'll need to get the Test Team on this as soon as possible. Until/unless this PR has that consensus, let's not add to their already heavy workload. 🙂 |
@costdev I think this looks good. It seems to be a deprecation due to a PHP version and not so much from WP 6.7. What I don't understand is I don't see this issue on my sites, running 6.6.2 or beta/RC and PHP 8.3.x. |
Not a deprecation, but rather that it went from a Warning to a Fatal Error in PHP 8.0. Ref Autovivification of |
Imho this looks good.
WP 6.7 is scheduled for release on November 12, 2024. Thinking four weeks is ample time to test this. Also this fix doesn't change the way the code works. Passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Previously,
WP_Upgrader::install_package()
attempted to get keys from aWP_Filesystem_*::dirlist()
result, expecting it to be an array. However,WP_Filesystem_*::dirlist()
may also returnfalse
. The subsequentarray_keys()
function call produces a Warning (PHP < 8.0) and Fatal Error (PHP 8.0+) because the first argument must be ofarray
type.This change checks for a
false
return value fromWP_Filesystem_*::dirlist()
and returns aWP_Error
fromWP_Upgrader::install_package()
.Trac ticket: https://core.trac.wordpress.org/ticket/61114