PHP notice

Trying to get property 'emailstatus' of non-object

/var/www/limesurvey/application/controllers/admin/tokens.php(198)

186                                 $iSurveyIdBounce = explode(": ", $item);
187                             }
188                             if (preg_match('/^X-tokenid/', $item))
189                             {
190                                 $tokenBounce = explode(": ", $item);
191                                 if ($iSurveyId == $iSurveyIdBounce[1])
192                                 {
193                                     $aData = array(
194                                     'emailstatus' => 'bounced'
195                                     );
196                                     $condn = array('token' => $tokenBounce[1]);
197                                     $record = Token::model($iSurveyId)->findByAttributes($condn);
198                                     if ($record->emailstatus != 'bounced')
199                                     {
200                                         $record->emailstatus = 'bounced';
201                                         $record->save();
202                                         $bouncetotal++;
203                                     }
204                                     $readbounce = imap_body($mbox, $count); // Put read
205                                     if (isset($thissurvey['bounceremove']) && $thissurvey['bounceremove']) // TODO Y or just true, and a imap_delete
206                                     {
207                                         $deletebounce = imap_delete($mbox, $count); // Put delete
208                                     }
209                                 }
210                             }

Stack Trace

#2
+
 /var/www/limesurvey/application/core/Survey_Common_Action.php(88): CAction->runWithParamsInternal(tokens, ReflectionMethod, array("YII_CSRF_TOKEN" => "708d2ded010d0a73c2d3c96151e78a928ac84805", "surveyid" => "468744", "sa" => "bounceprocessing", "iSurveyId" => "468744", ...))
83             $oMethod = new ReflectionMethod($this, $sDefault);
84         }
85 
86         // We're all good to go, let's execute it
87         // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
88         return parent::runWithParamsInternal($this, $oMethod, $params);
89     }
90 
91     /**
92     * Some functions have different parameters, which are just an alias of the
93     * usual parameters we're getting in the url. This function just populates
#6
+
 /var/www/limesurvey/application/controllers/AdminController.php(159): CController->run("tokens")
154                     $this->redirect(array('/admin/authentication/sa/login'));
155                 }
156 
157             }
158 
159             return parent::run($action);
160     }
161 
162     /**
163     * Routes all the actions to their respective places
164     *
#10
+
 /var/www/limesurvey/index.php(211): CApplication->run()
206         die (sprintf('%s should be writable by the webserver (766 or 776).', $runtimePath));
207     }
208 }
209 
210 Yii::$enableIncludePath = false;
211 Yii::createApplication('LSYii_Application', $config)->run();
212 
213 /* End of file index.php */
214 /* Location: ./index.php */
2018-09-05 15:09:29 Apache/2.4.18 (Ubuntu) Yii Framework/1.1.16