Skip to content

7.7.5: scoped plugin-update-checker fatals WP-CLI when the WordPress path isn't a literal prefix (e.g. ddev wp's /./) #155

Closed

Description

@arvoisa

Summary

In 7.7.5, every WP-CLI command crashes with a fatal error when the WordPress path isn't a literal prefix of the plugin path. Examples: wp --path=/var/www/html/./ …, which is what DDEV's ddev wp passes, a ../ in the path, or a plugin symlinked from outside the WordPress install. Version 7.6.7 works with the same path.

PHP Fatal error:  Uncaught RuntimeException: The update checker cannot determine if "/var/www/html/wp-content/plugins/blockstudio/blockstudio.php" is a plugin or a theme. This is a bug. Please contact the PUC developer. in .../blockstudio/lib/yahnis-elsts/plugin-update-checker/Puc/v5p6/PucFactory.php:74
#0 .../blockstudio/includes/classes/github-updater.php(23): BlockstudioVendor\YahnisElsts\PluginUpdateChecker\v5p6\PucFactory::buildUpdateChecker()
#1 .../blockstudio/includes/class-plugin.php(339): Blockstudio\Github_Updater->__construct()

Web requests aren't affected in that setup, because there ABSPATH is a clean path.

Cause

PucFactory::isPluginFile() first checks whether the file path starts with WP_PLUGIN_DIR as a plain string. With ABSPATH = /var/www/html/./, WP_PLUGIN_DIR is /var/www/html/./wp-content/plugins. That string isn't a prefix of BLOCKSTUDIO_FILE (/var/www/html/wp-content/plugins/…), so PUC falls back to reading the plugin header. The scoper broke that fallback:

lib/yahnis-elsts/plugin-update-checker/Puc/v5p6/PucFactory.php:146 (same on main):

if (function_exists('BlockstudioVendor\get_file_data')) {   // always false
    $headers = get_file_data($absolutePath, array('Name' => 'Plugin Name'), 'plugin');

php-scoper prefixed the string inside function_exists(). get_file_data isn't covered by 'exclude-functions' => array( '/^wp_/' ) in scoper.inc.php. As a result the fallback can never run, and buildUpdateChecker() throws.

Repro (DDEV WordPress, Blockstudio 7.7.5 active)

Run Result
7.7.5, wp --path=/var/www/html/./ eval 'echo "ok";' fatal (above)
7.7.5, wp --path=/var/www/html eval … ok
7.7.5, ./ path, --skip-plugins=blockstudio ok
7.7.5, ./ path, line 146 changed to function_exists('get_file_data') ok
7.6.7, ./ path ok

Suggested fix

Add get_file_data to exclude-functions in scoper.inc.php, for example array( '/^wp_/', 'get_file_data' ). Another option is a patcher that undoes the prefix inside that function_exists() string. Normalising the path before buildUpdateChecker() would also avoid the crash, but the fallback would stay broken for symlinked installs.

Side note: the same prefixing turns function_exists('shell_exec') / function_exists('proc_open') in lib/symfony/console/Terminal.php into checks that are always false. That's only cosmetic, but it's the same root cause.

Workaround

Add a wp-cli.yml with path: /var/www/html, an absolute path with no ./, in the project root.

Activity

  1. dnnsjsk commented on Oct 22, 2026

    @dnnsjsk
    Contributor

    Fixed and released in Blockstudio 7.7.6. The scoped updater now recognizes the global WordPress functions it needs when falling back to plugin-header detection. Regression coverage verifies the built release ZIP through WP-CLI using clean paths, ./ and ../ path segments, and plugins symlinked from outside WordPress. The fix was integrated in c9521d2; the path and symlink regressions are in 83c1479. Full CI and distribution checks passed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions