Repository navigation
fix: keep WordPress symbols unprefixed in the scoped update checker - #144
Merged
dnnsjsk merged 1 commit intoOct 22, 2026
Merged
Conversation
php-scoper prefixed WordPress constants, functions and Debug_Bar inside defined(), function_exists() and class_exists() strings of the bundled plugin-update-checker, so those checks were never true. Exclude them in scoper.inc.php and regenerate lib/.
Contributor
|
Included in Blockstudio 7.7.6, now officially released. This PR is merged into main as part of the reviewed release, with full CI and distribution checks passing for the release commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
php-scoper prefixes symbol names inside the bundled plugin-update-checker's existence checks, so they can never be true. Examples in
lib/:defined('BlockstudioVendor\WP_CLI')(UpdateChecker.php:105,WpCliCheckTrigger.php:40)defined('BlockstudioVendor\DOING_CRON')(Scheduler.php:194)defined('BlockstudioVendor\WPMU_PLUGIN_DIR')(Plugin/Package.php:146)function_exists('BlockstudioVendor\get_file_data')(PucFactory.php:146)function_exists('BlockstudioVendor\get_user_locale')(UpdateChecker.php:117)class_exists('BlockstudioVendor\Debug_Bar')(UpdateChecker.php:941)Upstream PUC 5.6 uses the plain WordPress names.
Effect: the WP-CLI check trigger is never registered, the cron check period tolerance never applies, the
get_file_data()fallback for plugins outsideWP_PLUGIN_DIRnever runs, the updater ignores the user locale, and the Debug Bar panel never loads.Cause:
scoper.inc.phpsetsexpose-global-constantsto false and only excludes/^WP_/classes and/^wp_/functions, so other WordPress names are treated as vendor symbols.Fix: exclude the WordPress constants (
/^WP_/,WPMU_PLUGIN_DIR,DOING_CRON), the WordPress functions PUC checks withfunction_exists(), andDebug_Bar, as described under "Excluded Symbols" in the php-scoper configuration docs.lib/is regenerated withcomposer scopeon PHP 8.4; the diff only touches these names (excluded constants are now also written fully qualified, e.g.\WP_PLUGIN_DIR).Measured with a CLI probe that defines the WordPress constants and stubs: WP-CLI hooks registered 0 -> 3, check period during cron 43200 s -> 42000 s, plugin outside
WP_PLUGIN_DIRdetected by header false -> true.Checks:
composer scope -- --checkmatches,composer test:dependenciespasses.Not changed here, same pattern outside WordPress names:
function_exists('BlockstudioVendor\iconv')and similar in symfony/string and symfony/console, and the bbPress helper names inPucReadmeParser. Happy to follow up if you want those excluded too.