MyBB Community Forums

Full Version: Why is this happening?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Your copy of MyBB running on AEG Clan  has experienced an error. Details of the error include:
---
Type: 2
File: admin/modules/forum/management.php (Line no. 145)
Message
count(): Parameter must be an array or an object that implements Countable
Back Trace: #0  errorHandler->email_error(2, count(): Parameter must be an array or an object that implements Countable, admin/modules/forum/management.php, 145) called at [/var/www/forum/inc/class_error.php:195]



=========================================
Every time I get this kinds of error, I had to modify PHP code inside that will check if the variable actually exists. How can I fix this kinds of things without modifying PHP code?
What's the version of MyBB you're running? And what about the PHP version?
(2020-03-31, 02:36 PM)noyle Wrote: [ -> ]What's the version of MyBB you're running? And what about the PHP version?

MyBB Version 1.8.22
PHP Version 7.2.24-0ubuntu0.18.04.3
Seems there is an error in management.php, line 145.
Original line
if(is_array($mybb->input['copygroups']) && count($mybb->input['copygroups'] > 0))

Seems better
if(is_array($mybb->input['copygroups']) && count($mybb->input['copygroups']) > 0)
Oh, the closing bracket..

By the way, @Crazycat has just created a pull request correcting this https://github.com/mybb/mybb/pull/3919

Anyway, if encountering any error that requires code modification, OP is encouraged to submit a bug report or create an issue addressing that in forum https://community.mybb.com/forum-157.html or GitHub https://github.com/mybb/mybb/issues/new/choose .
(2020-03-31, 02:16 PM)online0227 Wrote: [ -> ]Your copy of MyBB running on AEG Clan  has experienced an error. Details of the error include:
---
Type: 2
File: admin/modules/forum/management.php (Line no. 145)
Message
count(): Parameter must be an array or an object that implements Countable
Back Trace: #0  errorHandler->email_error(2, count(): Parameter must be an array or an object that implements Countable, admin/modules/forum/management.php, 145) called at [/var/www/forum/inc/class_error.php:195]



=========================================
Every time I get this kinds of error, I had to modify PHP code inside that will check if the variable actually exists. How can I fix this kinds of things without modifying PHP code?

Looks like there is no system-wise solving problem but only need to change the php code?
^ yes, change it as suggested and that should stop referred error.
OK, thank you very much all!