serdox
serdox

Reputation: 19

wp forum plugin error after move to another host

I decided to move to dreamhost since mediatemple is too expensive for me. i moved everything over but get one error with the forum plugin. i moved from 5.4 to php 5.6 fast cgi. when i changed to php 5.5 its still the same reporting

a php error says above the forum page:

Warning: Creating default object from empty value in wp-content/plugins/simple-forum/library/sf-database.php on line 2094

the referred code snippet is:

# 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;
}

the exact line says:

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

how to solve this? can anyone help please.

Upvotes: 0

Views: 45

Answers (1)

user4962466
user4962466

Reputation:

As described in this question Creating default object from empty value in PHP? from PHP 5.4+ the error is triggered when your $rlist[$x] is empty or not initialized.

So try initializing your array element with empty StdClass instance, and than adding value to your object

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

Upvotes: 1

Related Questions