Wp论坛插件移到另一个主机后出现错误


wp forum plugin error after move to another host

我决定搬到dreamhost,因为meditemple对我来说太贵了。我移动了一切,但得到一个错误与论坛插件。我从5.4移动到PHP 5.6快速cgi。当我切换到PHP 5.5时,它仍然是相同的报告

PHP错误提示:

警告:在第2094行从wp-content/plugins/simple-forum/library/sf-database.php的空值创建默认对象

引用的代码片段是:

# sf_filter_new_post_list()
#
# Support: Returns filtered list that current user has permissions to
#   $recordset: Full list of forum/topics
# ------------------------------------------------------------------
function sf_filter_new_post_list($recordset)
{
if(!$recordset) return '';
$rlist = array();
$x = 0;
foreach($recordset as $record)
{
$rlist[$x]->forum_id=$record->forum_id;
$rlist[$x]->topic_id=$record->topic_id;
$x++;
}
return $rlist;
}

确切地说:

$rlist[$x]->forum_id=$record->forum_id;

如何解决?有谁能帮忙吗?

如本问题所述,在PHP中从空值创建默认对象?从PHP 5.4+开始,当您的$rlist[$x]为空或未初始化时触发错误。

所以尝试用空StdClass实例初始化你的数组元素,然后给你的对象添加值

foreach($recordset as $record){
   $rlist[$x] = new StdClass();
   $rlist[$x]->forum_id = $record->forum_id;
   $rlist[$x]->topic_id = $record->topic_id;
   $x++;
}