Fastcgi Sent In Stderr: "php Message: Php Warning: Illegal String Offset

Hello I am getting the following WARNING
2017/06/06 09:41:54 [error] 906#906: *94496 FastCGI sent in stderr: "PHP message: PHP Warning: Illegal string offset 'type' in /home/public_html/app/addons/discussion/func.php on line 380
my LINE 380 is as follows
        if (empty($discussion) || ($discussion['type'] != 'R' && $discussion['type'] != 'B')) {

Hello I am getting the following WARNING
2017/06/06 09:41:54 [error] 906#906: *94496 FastCGI sent in stderr: "PHP message: PHP Warning: Illegal string offset 'type' in /home/public_html/app/addons/discussion/func.php on line 380
my LINE 380 is as follows
        if (empty($discussion) || ($discussion['type'] != 'R' && $discussion['type'] != 'B')) {

Hello! Replace it

if (empty($discussion) || ($discussion['type'] != 'R' && $discussion['type'] != 'B')) {

with this

if (empty($discussion) || (!empty($discussion['type']) && ($discussion['type'] != 'R' && $discussion['type'] != 'B'))) {

Thanks - That did fix that line error but after I implement your code I got another WARNING on line 383

$rating = db_get_field("SELECT AVG(a.rating_value) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i AND b.status = 'A' AND a.rating_value > ?i", $discussion['thread_id'], 0);

Thanks - That did fix that line error but after I implement your code I got another WARNING on line 383

$rating = db_get_field("SELECT AVG(a.rating_value) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i AND b.status = 'A' AND a.rating_value > ?i", $discussion['thread_id'], 0);

Make it as follows:

$rating = 0;

if (!empty($discussion[‘thread_id’])) {
$rating = db_get_field(“SELECT AVG(a.rating_value) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i AND b.status = ‘A’ AND a.rating_value > ?i”, $discussion[‘thread_id’], 0);
}

The best way to fix it permanently is to post in the bug tracker.