Support » Plugin: Broken Link Checker » Fatal error: Uncaught Error: Call to a member function load_modules() on null

  • Resolved digitaldog247



    I’ve had this plugin installed on our production site for over a year now and been very happy with it.

    However, the other day, when I refreshed the permalinks on the production site, the site crashed. When I check the logs, this is the error I see:

    PHP Fatal error:  Uncaught Error: Call to a member function load_modules() on null in /code/wp-content/plugins/broken-link-checker/core/init.php:291
    Stack trace:
    #0 /code/wp-includes/class-wp-hook.php(287): blc_init('')
    #1 /code/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #2 /code/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #3 /code/wp-settings.php(540): do_action('init')
    #4 phar:///opt/pantheon/wpcli/wp-cli-2.4.0.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): require('/code/wp-settin...')
    #5 phar:///opt/pantheon/wpcli/wp-cli-2.4.0.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1158): WP_CLI\Runner->load_wordpress()
    #6 phar:///opt/pantheon/wpcli/wp-cli-2.4.0.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
    #7 phar:///opt/pantheon/wpcli/wp-cli-2.4.0.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
    #8 phar:///opt/pantheon/wpcli/wp-cli-2.4.0.phar/vendor/wp-cli/w in /code/wp-content/plugins/broken-link-checker/core/init.php on line 291

    We have done this many times in this production environment without this issue, so I’m not sure what changed. I was able to get the site back up and running by removing BLC from the active plugins directly in the database.

    At this point, the site is very large and does have a lot of links to crawl through, is it possible the plugin was just overloaded?

Viewing 6 replies - 16 through 21 (of 21 total)
  • Plugin Support Kasia – WPMU DEV Support


    Hello @digitaldog247 ,

    Well yes. In the changelog, there will be a list of the fixed bugs. Notification about the update will show automatically on the site when a new version is released.

    kind regards,

    Hi all,

    Been looking into this issue now that I have some time and I think I’ve narrowed down the problem to the blc_init function within the core/init.php file.

    Like digitaldog mentioned the issue is a call to load_modules on a null object. The null object in question is the $blc_config_manager used within the blc_init method.

    In the latest version of the plugin the activation.php file is required during the initialization of the plugin which in turn requires the modules.php file. When the blc_init function is called during the WP init action it attempts to load the modules.php file using require_once, but since that file has already been required it doesn’t load and the $blc_module_manager variable initialized in modules.php is null and fails when it attempts to run the load_modules method.

    Changing the require_once within the blc_init function to requires seems to fix the issue but I have no idea if this might cause other issues, haven’t tested it enough yet. Maybe the dev team can shed some further light on the issue.

    EDIT: Just to be clear this error only seems to occur when I use wp-cli command as I’m bringing up the site.

    @digitaldog247 @wpmudev-support2

    • This reply was modified 1 year, 2 months ago by chexwarrior.
    • This reply was modified 1 year, 2 months ago by chexwarrior.
    Plugin Support Prathamesh – WPMU DEV Support


    Hello @chexwarrior,

    We have sent this to the Broken Link Checker team and requested them to give a quick look into this and check if there can be any quick fix to it.

    I would get back to you here with an update on it. Kindly note that the development team is constantly working on such critical issues which is why it can take a bit more time than usual to get back with a reply on it. I appreciate your patience here.

    Thank you,
    Prathamesh Palve

    Plugin Support Prathamesh – WPMU DEV Support


    Hello @chexwarrior,

    Could you try to replace includes/module-manager.php with this file:

    The above fix is just an assumption. I’m not sure it will fix the issue if you would write what WP-CLI commands and workflow you are using it would help debug the issue better.

    Please let me know how that goes and we would be happy to try to help and resolve this asap.

    Thank you,
    Prathamesh Palve

    Looks like it didn’t fix the issue, got the same error as before. My workflow is as follows:

    All of my WordPress sites are built in Docker containers, I don’t think that should matter much for this but its just some background. I am using PHP 7.3.

    When I build a site locally I run the following commands:
    1. Install composer packages (I use wpackagist to install plugins/themes)
    2. I wait for the Docker container with my database to be ready by continuously running the wp db check command until it stops giving an error (this always works with no issue)
    3. I replace all instances of the production site url with a local site url using the wp search-replace, this is usually where the error occurs though I’ve noticed it happens with other wp cli commands if I skip this one.
    4. I activate some dev plugins: wp plugin activate debug-bar query-monitor
    5. I run wp core update-db

    Like I mentioned previously it doesn’t seem to matter which wp cli commands I skip or run this error eventually occurs so I’m assuming it happens as soon as one of the wp cli commands loads wp core and initializes the plugins. Running the wp-cli commands with —skip-packages does fix the issue, but I was hoping to not have to use that option.

    Plugin Support Patrick – WPMU DEV Support


    Hi @chexwarrior

    Thank you for the flow.

    We sent this to our developers, once hearing back from the team, we will let you know.

    Best Regards
    Patrick Freitas

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Fatal error: Uncaught Error: Call to a member function load_modules() on null’ is closed to new replies.