• Resolved eclev91

    (@eclev91)


    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 like do_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 the add_commands function in AtumCli.php removes the error, but I haven’t verified that code still does what it’s supposed to do.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Salva Machi

    (@salvamb)

    Hi @eclev91

    Which ATUM version are you using, please?
    We’ve added recently a check before using the WP CLI’s add_hook method to make sure it’s available and avoid this kind of issue. This modification was added to ATUM 1.9.15.

    Best Regards,
    Salva.

    Thread Starter eclev91

    (@eclev91)

    @salvamb I think you accidentally marked this ticket as resolved.

    Using version 1.9.15

    The issue seems to be that even though add_hook is available, it subsequently runs describe_callable, which is _not_ available. Like I said, though, seems a bit like an upstream problem that you would want to temporarily work around.

    Plugin Author Salva Machi

    (@salvamb)

    Hi @eclev91

    Yes, as you’ve said, it’s an error happening outside of ATUM. Not sure why add_hook is available and describe_callable isn’t.
    We’ll check if this method is available before accessing the add_hook as a workaround but perhaps the same can happen with any other method called by WP_CLI itself later and we cannot check for the availability of all the methods used internally by WP_CLI… This is something that you should ask WP_CLI to fix because it’s their responsibility.

    Best Regards,
    Salva.

    Thread Starter eclev91

    (@eclev91)

    Plugin Author Salva Machi

    (@salvamb)

    Perfect. Thank you!
    I hope they fix it ??

    Anyway, we’ve already added the workaround to ATUM and now we are also checking if the describe_callable is available before continuing. This will be released on the next version.

    Best Regards,
    Salva.

    • This reply was modified 2 years, 7 months ago by Salva Machi.
    Thread Starter eclev91

    (@eclev91)

    @salvamb for whatever reason, this still throws an error for me. Your check uses is_callable, which for some reason returns true. If I replace it with method_exists, it works as expected.

    Plugin Author Salva Machi

    (@salvamb)

    Hi @eclev91

    That’s very weird indeed. The method doesn’t exist but is callable. Makes no sense ??
    Anyway, I’ve just changed it as you suggested to avoid this issue. This will go on the next version ??

    Best Regards,
    Salva.

    Thread Starter eclev91

    (@eclev91)

    @salvamb Thanks!

    Plugin Author Salva Machi

    (@salvamb)

    @eclev91 You’re welcome ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Breaks on Bedrock install with wp-cli/wp-cli-bundle dependency’ is closed to new replies.