MYBB 警告 [2] count():参数必须是实现可数 - 行:906 的数组或对象



嗨,抱歉,如果配音,但我不知道如何修复PHP 7.24上的MyBB 1.8.15错误 警告 [2] count((:参数必须是实现可数的数组或对象 - 行:906

// Build the threaded post display tree.
$query = $db->query("
SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
FROM ".TABLE_PREFIX."posts p
WHERE p.tid='$tid'
$visible
ORDER BY p.dateline
");
while($post = $db->fetch_array($query))
{
if(!$postsdone[$post['pid']])
{
if($post['pid'] == $mybb->input['pid'] || ($isfirst && !$mybb->input['pid']))
{
$postcounter = count($postsdone);
$isfirst = 0;
}
$tree[$post['replyto']][$post['pid']] = $post;
$postsdone[$post['pid']] = 1;
}
}
$threadedbits = buildtree();
$posts = build_postbit($showpost);
eval("$threadexbox = "".$templates->get("showthread_threadedbox")."";");
$plugins->run_hooks("showthread_threaded");
}

906行 给出错误的是$postcounter = count($postsdone);

如果$postsdone未被评估为"可数"(在这种情况下,如果它不是数组(,则会发生此错误。我会在执行 count($postsdone( 之前验证$postsdone是一个数组。例如:

if(is_array($postsdone)){
$postcounter = count($postsdone);
}
else{
// set $postcounter to whatever you want it be...
}

相关内容

  • 没有找到相关文章

最新更新