Skip to content

fix: keep WordPress symbols unprefixed in the scoped update checker - #144

Merged
dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:fix/scoper-wordpress-constants
Oct 22, 2026
Merged

dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:fix/scoper-wordpress-constants

Conversation

@Contributolo

Copy link
Copy Markdown
Collaborator

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 outside WP_PLUGIN_DIR never runs, the updater ignores the user locale, and the Debug Bar panel never loads.

Cause: scoper.inc.php sets expose-global-constants to 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 with function_exists(), and Debug_Bar, as described under "Excluded Symbols" in the php-scoper configuration docs. lib/ is regenerated with composer scope on 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_DIR detected by header false -> true.

Checks: composer scope -- --check matches, composer test:dependencies passes.

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 in PucReadmeParser. Happy to follow up if you want those excluded too.

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/.
@dnnsjsk
dnnsjsk merged commit 7b0a3c6 into inline0:main Oct 22, 2026
@dnnsjsk

dnnsjsk commented Oct 22, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants