MyBB Community Forums

Full Version: php 7.2 count(): Parameter must be an array or an object that implements Countable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Edit2: Sorry, this is not related to MyBB. I have confirmed that errors apear only when viewing a user profile through the Tapatalk plugin. This plugin calls some fucntions from inc/functinos_online.php and maybe uses incorrect parameters.

Hi, I noticed these warnings:

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>606</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>624</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>636</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>648</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>660</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>702</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>717</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>
(2019-09-11, 04:45 PM)panayot Wrote: [ -> ]Edit2: Sorry, this is not related to MyBB. I have confirmed that errors apear only when viewing a user profile through the Tapatalk plugin. This plugin calls some fucntions from inc/functinos_online.php and maybe uses incorrect parameters.

Hi, I noticed these warnings:

<error>
<dateline>1568219801</dateline>
<script>inc/functions_online.php</script>
<line>606</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>count(): Parameter must be an array or an object that implements Countable</message>
</error>

(...)

Still can't get to understand why. In file ./inc/functinos_online.php there's a declaration of these variables before any function defined in this file can be called:
$uid_list = $aid_list = $pid_list = $tid_list = $fid_list = $ann_list = $eid_list = array();
I guess this line initializes the variables as empty arrays and should prevent exactly this error. But when this file is included by the plugin an error is generated here:

if(!is_array($attachments) && count($aid_list) > 0)


which means that $aid_list is somehow not initialized at that moment. Maybe the plugin somehow resets the initialized arrays. But the only mention of aid_list in the plugin code is this:

global $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $ann_list, $eid_list, $plugins, $user, $parameters;


But my PHP knowledge is not very good. I have sent bug report to Tapatalk.