I just glanced at the code. There are two things to bear in mind.
1. That piece of code, regardless of Q2A, has something smelly. Because on L124 the $m[1] access is protected checking that $m[1] actually has something in it. However, on L135, it is not. Protecting L135 would prevent the issue.
2. I can't think of any case in Q2A in which you could have a u_message event in the ^eventlog table without having the text messageid=X as a param. Maybe there is a plugin inserting records in the ^eventlog table with the u_message string. That shouldn't be the best approach but querying the ^eventlog isn't either.
In conclusion, move the curly bracket in L125 exactly before the curly bracket in L136. That's the fix.
If you want to have more information about the guilty piece of text that's generating the issue you could replace the whole IF in L123 with:
if(preg_match('/messageid=([0-9]+)/',$ustring,$m) === 1) {
$event['messageid'] = (int)$m[1];
} else {
if (qa_get_logged_in_handle() === 'pupi1985') {
echo '<pre>';
var_dump($event);
echo '</pre>';
}
}
Replace pupi1985 with your own username in the site so that only you can see the error log when it appears. Then paste it here to see what the root cause of the issue is.