Support » Plugin: Responsive Menu - Create Mobile-Friendly Menu » WP-CLI error after last update

  • Resolved Fernando Garcia

    (@fernandoaureonet)


    Hello,
    Today I’ve updated the plugin and it runs ok. But after the update, I have a problem with WP-CLI. When I write the command “wp plugin list”, i write me the next error:
    “Catchable fatal error: Argument 1 passed to ResponsiveMenu\Database\Migration::__construct() must be an instance of ResponsiveMenu\Management\OptionManager, null given, called in /home/sar/public_html/wp-content/plugins/responsive-menu/migration.php on line 17 and defined in /home/sar/public_html/wp-content/plugins/responsive-menu/app/Database/Migration.php on line 13”

    Do you know what itr means?

    Thanks for all.

Viewing 10 replies - 1 through 10 (of 10 total)
  • From what I can tell, version 3.1.1 had a slight typo in the migration.php file. Line 3 init should be as follows:

    add_action('admin_init', function() {

    rather than:

    add_action('init', function() {

    Changing this line resolved the errors for me.

    Joe

    Peter Featherstone

    (@peterfeatherstone-1)

    Hey Joe,

    That’s not a typo, that is purposeful as the migration scripts need to run on the front end if there is a new version available otherwise all sorts of issues can occur.

    I’m not sure why it is causing that issue though as the OptionManager should be accessible at this point.

    I wonder if someone can give me steps to recreate the issue as WP CLI is not something I have used before.

    All the best

    Peter

    Hello,

    From what I gathered the steps to reproduce are to:

    1) Install WordPress Site
    2) Install WP-CLI on environment using steps found here: http://wp-cli.org/#installing
    3) Run command wp plugin list within WP site installation directory
    4) Observe plugins are listed
    5) Run command wp plugin install responsive-menu
    6) Run command wp plugin activate responsive-menu
    7) Run wp plugin list
    8) Observe Fatal Error reported above.

    I have tested these steps on my own installation and successfully reproduced the error. This does appear to be a third-party issue and not an issue with WP-CLI itself.

    Cheers!

    Peter Featherstone

    (@peterfeatherstone-1)

    Hey there,

    Thanks for the heads up and useful information! I have recreated the error and subsequently fixed it here.

    Can you please try the following and let me know if it fixes the issue for you before I add it to the next release scheduled for Friday.

    1. Open up the file config/wp/services.php
    2. Add the following on line 8 global $services_428734872364;, inserting it above the current line $services_428734872364 = new ResponsiveMenu\Container\Container;

    All the best

    Peter

    Hi Peter,
    I’ve done the steps you wrote and.. it runs!!

    Thank you very much!!

    Greetings,
    Fernando

    Peter Featherstone

    (@peterfeatherstone-1)

    Hey Fernando,

    You are more than welcome and glad it solved it for you!

    Peter

    Hello All,

    I wanted to come here to report the same issue with updating responsive-menu over wp-cli.

    I received the same error when I ran:

    wp plugin status

    PHP Catchable fatal error: Argument 1 passed to ResponsiveMenu\Database\Migration::__construct() must be an instance of ResponsiveMenu\Management\OptionManager, null given, called in /wordpress/wp-content/plugins/responsive-menu/migration.php on line 17 and defined in /wordpress/wp-content/plugins/responsive-menu/app/Database/Migration.php on line 13
    Catchable fatal error: Argument 1 passed to ResponsiveMenu\Database\Migration::__construct() must be an instance of ResponsiveMenu\Management\OptionManager, null given, called in /wordpress/wp-content/plugins/responsive-menu/migration.php on line 17 and defined in /wordpress/wp-content/plugins/responsive-menu/app/Database/Migration.php on line 13

    It worked after I used @peterfeatherstone-1’s suggestion. The only difference for me was that services.php file was not in the /wp-content/plugins/responsive-menu/config/wp folder but rather in the /wp-content/plugins/responsive-menu/config/ folder one level above.

    Thanks for all the help and coming up with a work around!

    Ross

    Peter Featherstone

    (@peterfeatherstone-1)

    Hi Ross,

    Is this still not working for you as it was fixed in version 3.1.2 released last week?

    Also, oops, just saw that typo above, you’re right it’s not inside the wp folder, it’s one level above as Ross has mentioned.

    Please let me know.

    Peter

    Hi Peter,

    I was updating my test site from 3.1.1 to 3.1.2 so I will let you know whenever 3.1.3 is released and I attempt to update via wp-cli.

    Thanks,
    Ross

    Peter Featherstone

    (@peterfeatherstone-1)

    Hi Ross,

    Ah right, ok that makes complete sense now. I had just figured that if you are upgrading your plugins then it obviously means you don’t have the latest one yet!

    It’s been a long day for me so far!

    Peter

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WP-CLI error after last update’ is closed to new replies.