• Resolved Michal

    (@mslepko)


    Hello. I see this error in the logs when using this plugin. I’ve manged to fix it by directly editing the plugin files but it would be good if you could take a look as well.

    PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in /wp-content/plugins/cookie-control/cookiecontrol.php:1164\nStack trace:\n#0 /wp-includes/class-wp-hook.php(308): cookiecontrol_args()\n#1 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()\n#2 /wp-includes/plugin.php(517): WP_Hook->do_action()\n#3 /wp-includes/general-template.php(3059): do_action()\n#4 /wp-content/themes/theme/footer-home.php(138): wp_footer()\n#5 /wp-includes/template.php(783): require_once('...')\n#6 /wp-includes/template.php(718): load_template()\n#7 /wp-includes/general-template.php(92): locate_template()\n#8 /wp-content/themes/theme/home.php(294): get_footer()\n#9 /wp-includes/template-loader.php(106): include('...')\n#10 /wp-blog-header.php(19): require_once('...')\n#11 /index.php(17): require('...')\n#12 {main}\n thrown in /wp-content/plugins/cookie-control/cookiecontrol.php on line 1164,

    All the sizeof calls in the cookiecontrol.php are throwing an error, a simple fix would be to check if $cookiecontrol_settings[‘altLanguages’] is an array before checking sizeof

    <?php if ( is_array($cookiecontrol_settings[‘excludedCountries’]) && sizeof($cookiecontrol_settings[‘excludedCountries’]) > 0 && !empty($cookiecontrol_settings[‘excludedCountries’]) ) : ?>

    Thanks
    Michal

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tasos Fel

    (@tasoscivicuk)

    Hello @mslepko

    It seems like you have an older version of the cookie control plugin. Please download and install the latest version from the WordPress plugin repository. You may have to reconfigure your settings so before update the plugin please back up your database.

    Best regards,
    Tassos

    Thread Starter Michal

    (@mslepko)

    I’ve just noticed I have 2 plugins installed

    Civic Cookie Control 8 – Version 1.43
    Cookie Control 8 – Version 1.4

    Thanks for the quick reply.

    Thanks
    Michal

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Fatal Error with PHP8’ is closed to new replies.