Breaks on Bedrock install with wp-cli/wp-cli-bundle dependency
-
I have a Bedrock install and the WP-CLI bundle is required via Composer. Something to do with the loading order of WP_CLI is causing your plugin to trigger a fatal error.
Fatal error: Uncaught Error: Call to undefined function WP_CLI\Utils\describe_callable() in /var/www/html/vendor/wp-cli/wp-cli/php/class-wp-cli.php:274 Stack trace: #0 /var/www/html/web/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Cli/AtumCli.php(43): WP_CLI::add_hook() #1 /var/www/html/web/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Cli/AtumCli.php(206): Atum\Cli\AtumCli->__construct() #2 /var/www/html/web/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Inc/Main.php(257): Atum\Cli\AtumCli::get_instance() #3 /var/www/html/web/wp/wp-includes/class-wp-hook.php(307): Atum\Inc\Main->load_modules() #4 /var/www/html/web/wp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #5 /var/www/html/web/wp/wp-includes/plugin.php(474): WP_Hook->do_action() #6 /var/www/html/web/wp/wp-settings.php(519): do_action() #7 /var/www/html/web/wp-config.php(9): require_once('...') #8 /var/www/html/web/wp/wp-load.php(55): require_once('...') #9 /var/www/html/web/wp/wp-admin/admin.php(34): require_once('...') #10 /var/www/html/web/wp/wp-admin/plugins.php(10): require_once('...') #11 /tmp/wp-cli-extract-from-phar-6266d799ea3219.68182367-router.php(128): require_once('...') #12 {main} thrown in /var/www/html/vendor/wp-cli/wp-cli/php/class-wp-cli.php on line 274
Not exactly sure why that function is unavailable. You’re able to call
\WP_CLI::do_hook
, which depends on the\WP_CLI\Utils
class, without the Utils class being available, per the error message. Seems likedo_hook
shouldn’t be available to call in this context, either, and that’s an issue that should be fixed upstream in WP-CLI itself.Moving the registration of
before_add_command:atum
into theadd_commands
function in AtumCli.php removes the error, but I haven’t verified that code still does what it’s supposed to do.
- The topic ‘Breaks on Bedrock install with wp-cli/wp-cli-bundle dependency’ is closed to new replies.