• Resolved omegarobot

    (@omegarobot)


    Hi,

    I update sites using WP-CLI wp plugin update --all and they’re failing with the following error message:

    PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/htdocs/wp-content/plugins/stopbadbots/functions/functions.php:3990
    Stack trace:
    #0 /var/www/htdocs/wp-content/plugins/stopbadbots/stopbadbots.php(1131): stopbadbots_block_httptools()

    Tested on version 11.45 and 11.54.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author sminozzi

    (@sminozzi)

    Hello,

    You are welcome.
    Line 3990 of the file functions.php is:

    $table_name = $wpdb->prefix . ‘sbb_badips’;

    and does not include the word count().

    Please double-check the plugins dashboard to confirm if your version is 11.54.

    If so, you need to reinstall the plugin because the files are damaged.

    I should add that the plugin update process is entirely handled by WordPress, and we don’t play any role in that activity.
    Regards,

    Bill




    Thread Starter omegarobot

    (@omegarobot)

    Hi Bill,

    Sorry for the confusion. I’m not entirely sure, but the Line 3990 error might be from version 11.45.
    I updated the plugin to version 11.54 in WP Dashboard, then run the wp plugin update --all command again in Terminal — the error caught is now in Line 4253:

    PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/htdocs/wp-content/plugins/stopbadbots/functions/functions.php:4253
    Stack trace:
    #0 /var/www/htdocs/wp-content/plugins/stopbadbots/stopbadbots.php(1134): stopbadbots_block_httptools()

    I checked the mentioned line in functions.php and found the following:

        if (count($astopbadbots_http_tools) < 1) {
            return '';
        }

    From what I understand, $astopbadbots_http_tools might be null and count() doesn’t like it, like mentioned in this example: https://www.php.net/manual/en/function.count.php#count.example.badexample

    Hope that helps.

    Plugin Author sminozzi

    (@sminozzi)

    Thank you!
    I just uploaded the version 11.55
    Please, let me know if it works fine on your server.

    Thread Starter omegarobot

    (@omegarobot)

    That worked! Thanks, Bill.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP-CLI: Fatal error: Uncaught TypeError’ is closed to new replies.