Uncaught TypeError

count(): Argument #1 ($var) must be of type Countable|array, null given

(File: /data/core/classes/User.php)

http://smessiecraft.com/forum/topic/58-survival/

File: /data/core/classes/User.php

                                                                        }
            }
            if (Session::exists($this->_admSessionName)) {
                $user = Session::get($this->_admSessionName);
                if ($user == $this->data()->id && $this->find($user, $field)) {
                    $this->_isAdmLoggedIn = true;
                }
            }
        } else {
            $this->find($user, $field);
        }
    }

    /**
     * Get this user's main group CSS styling
     *
     * @return string|bool Styling on success, false if they have no groups.
     */
    public function getGroupClass() {
        $groups = $this->_groups;
        if (count($groups)) {
            foreach ($groups as $group) {
                return 'color:' . htmlspecialchars($group->group_username_color) . '; ' . htmlspecialchars($group->group_username_css);
            }
        }

        return false;
    }
    
    /**
     * Get the logged in user's IP address.
     *
     * @return string Their IP.
     */
    public function getIP() {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            return $_SERVER['HTTP_CLIENT_IP'];
        } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        

                                                    
File: /data/modules/Forum/pages/forum/view_topic.php

                                                        
        if (count($post_reactions_query)) {
            foreach ($post_reactions_query as $item) {
                if (!isset($post_reactions[$item->reaction_id])) {
                    $post_reactions[$item->reaction_id]['count'] = 1;

                    $reaction = $queries->getWhere('reactions', array('id', '=', $item->reaction_id));
                    $post_reactions[$item->reaction_id]['html'] = $reaction[0]->html;
                    $post_reactions[$item->reaction_id]['name'] = $reaction[0]->name;

                    if ($reaction[0]->type == 2) $total_karma++;
                    else if ($reaction[0]->type == 0) $total_karma--;
                } else {
                    $post_reactions[$item->reaction_id]['count']++;
                }

                $reaction_user = new User($item->user_given);
                $post_reactions[$item->reaction_id]['users'][] = array(
                    'username' => $reaction_user->getDisplayname(true),
                    'nickname' => $reaction_user->getDisplayname(),
                    'style' => $reaction_user->getGroupClass(),
                    'avatar' => $reaction_user->getAvatar(500),
                    'profile' => $reaction_user->getProfileURL()
                );
            }
        }
    }

    // Purify post content
    $content = Util::replaceAnchorsWithText(Output::getDecoded($results->data[$n]->post_content));
    $content = $emojione->unicodeToImage($content);
    $content = Output::getPurified($content, true);

    // Get post date
    if (is_null($results->data[$n]->created)) {
        $post_date_rough = $timeago->inWords($results->data[$n]->post_date, $language->getTimeLanguage());
        $post_date = date('d M Y, H:i', strtotime($results->data[$n]->post_date));
    } else {
        $post_date_rough = $timeago->inWords(date('d M Y, H:i', $results->data[$n]->created), $language->getTimeLanguage());
        $post_date = date('d M Y, H:i', $results->data[$n]->created);
    }

                                                    
File: /data/index.php

                                                                    die();
        }
    } else {
        // Use recursion to check - might have URL parameters in path
        $path_array = explode('/', $route);

        for ($i = count($path_array) - 2; $i > 0; $i--) {

            $new_path = '/';
            for($n = 1; $n <= $i; $n++){
                $new_path .= $path_array[$n] . '/';
            }

            $new_path = rtrim($new_path, '/');

            if (array_key_exists($new_path, $modules)) {
                $path = join(DIRECTORY_SEPARATOR, array(ROOT_PATH, 'modules', $modules[$new_path]['module'], $modules[$new_path]['file']));

                if (file_exists($path)) {
                    $pages->setActivePage($modules[$new_path]);
                    require($path);
                    die();
                }
            }

        }

        // 404
        require(ROOT_PATH . '/404.php');
    }
}