I'm updating old software to remove errors and warnings in PHP 7.4 (I have not written a single line of code in over 15 years so consider me completely new).
The offending code is:
if ( count($forum_moderators[$forum_id]) > 0 )
{
$l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$moderator_list = implode(', ', $forum_moderators[$forum_id]);
}
else
{
$l_moderators = ' ';
$moderator_list = ' ';
}
If there is a user designated as a moderator, there is no error; but, if the count returns "0", the error is:
Warning: count(): Parameter must be an array or an object that implements Countable
This seems like it should have a simple answer but everything I have tried just adds more warnings or errors.