Joomla dispatcher.php and event.php Fix Errors

There are a few plugins that aren’t compatible with PHP 5.3+ and Joomla 1.5x, and they may show up like the error messages below:

PHP Warning: Parameter 2 to plgContentEmailCloak() expected to be a reference, value given in /libraries/joomla/event/dispatcher.php on line 136


PHP Warning: Parameter 2 to plgContentLoadModule() expected to be a reference, value given in /libraries/joomla/event/dispatcher.php on line 136
PHP Warning: Parameter 2 to plgContentPagebreak() expected to be a reference, value given in /libraries/joomla/event/dispatcher.php on line 136

PHP Warning: Parameter 2 to plgContentJA_highslide::onPrepareContent() expected to be a reference, value given in /libraries/joomla/event/event.php on line 67
PHP Warning: Parameter 2 to plgContentJA_tabs::onPrepareContent() expected to be a reference, value given in /libraries/joomla/event/event.php on line 67

Fortunately, this is a pretty simple thing to fix; look for line 136 in dispatcher.php and line 67 in event.php and add this one single line;

$args[1]   = & $args[1];

So your final code (for dispatcher.php) will look like this:

if (function_exists($observer[‘handler’]))
{
   $args[1]   = & $args[1];
   $result[] = call_user_func_array($observer[‘handler’], $args);
}

and for event.php:

if (method_exists($this, $event)) {
  $args[1] = & $args[1];
  return call_user_func_array ( array($this, $event), $args );
} else {

Alternatively, you can download the fix here. This is tested working on Joomla 1.5.23+. Hope this helps!

2 Comments

  1. Pingback: Errors after upgrading PHP to 5.4 in Joomla dispatcher.php and event.php - Technology

  2. Pingback: Errors after upgrading PHP to 5.4 in Joomla 1.5.25 dispatcher.php and event.php | DL-UAT

Leave a Reply

Your email address will not be published. Required fields are marked *