“Warning: Parameter 1 to” “expected to be a reference, value given in”

We just upgraded an old Joomla website from PHP 5.2 from PHP 5.3 and got Warnings in a few pages

 

The line of code that was spitting out the error was:

 

if (method_exists($this, $event)) {
return call_user_func_array ( array($this, $event), $args );
} else {

 

Adding a @ sign fixed the issue:

if (method_exists($this, $event)) {
return @call_user_func_array ( array($this, $event), $args );
} else {