Support » Plugin: Author Category » count(): Parameter must be an array or an object that implements Countable

  • Hi there,

    I found a bug when running your plugin on PHP 7.2. Also, I’m using the Docker wordpress container running latest.

    Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-content/plugins/author-category/author-category.php on line 119

    They’ve implemented stricter rules on the count() function and in your plugin there is a count($cat) > 0 that I believe is the culprit.

            public function user_default_category_option($false){
                $cat = $this->get_user_cat();
                if (!empty($cat) && count($cat) > 0){
                    return $cat;
                }
                return false;
            }

    Can you add a check to see if the $cat is_array() first before counting?

    Love your plugin, gives me the permissons I need without all the extra weight of some of these massive role/permissions editor plugins.

    Keep up the great work!

  • The topic ‘count(): Parameter must be an array or an object that implements Countable’ is closed to new replies.