0

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.

Happy Coding
  • 2,517
  • 1
  • 13
  • 24
serdox
  • 19
  • 10
  • 2
    check this question http://stackoverflow.com/questions/8900701/creating-default-object-from-empty-value-in-php –  Sep 27 '15 at 12:42
  • yeash im somehow a noob. i get that it has to do with error reporting but need exact instruction for me to solve this. they say put this code in etc. where? which file? – serdox Sep 27 '15 at 14:57

1 Answers1

1

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++;
}
Community
  • 1
  • 1
  • okey i downgraded to 5.3 for now but my host will probably soon upgrade all systems to 5.6. i will then come back to this solution i guess. thanks for your help for now. – serdox Sep 28 '15 at 16:16
  • hey @diego i changed the lines as you said it it gave this error with ?> in the line: Parse error: syntax error, unexpected end of file in /wp-content/plugins/simple-forum/library/sf-database.php on line 4127 – serdox Nov 11 '15 at 14:01