autoloader: Avoid a deprecation notice in Autoloader_Locator::find_latest_autoloader()
#38245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes:
If one of the cached plugin paths has gone missing,
get_autoloader_version()
will returnnull
when trying to check it. Avoid passing thatnull
tois_version_update_required()
.This sort of thing happens weekly during Atomic upgrades, because there they have symlinks
wp-content/plugins/jetpack
→/wordpress/plugins/jetpack/latest
→/wordpress/plugins/jetpack/<ver>
and the update process deletes the old<ver>
at the same time as creating the new and updating thelatest
symlink.Other information:
Jetpack product discussion
p1720462998876079/1720457892.196259-slack-C01U2KGS2PQ
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Without this PR, this process should produce deprecation warnings about passing null to
substr
andversion_compare
. With it, it should no longer do so.wp-content/plugins/jetpack
towp-content/plugins/jetpack-xxx
, then symlinkwp-content/plugins/jetpack
to that. Load a page.wp-content/plugins/jetpack-xxx
towp-content/plugins/jetpack-yyy
, then symlinkwp-content/plugins/jetpack
to that. Load a page.(if for some reason the PR doesn't seem to fix it, ensure that the PR's version of the autoloader is active rather than a trunk version from some other plugin)