Fix for Joomla 2.5 Warning: Illegal offset type in isset or empty

by Koree S. Monteloyola

 

If you have encoutered this error in Joomla 2.5:

Warning: Illegal offset type in isset or empty in /var/www/libraries/joomla/application/menu.php on line 127

The problem might be an outdated or missing code in the component's router.php. In Joomla 1.6 there is a new logic for BuildRoute.

Make sure that the change in the BuildRoute method from Joomla 1.5 to Joomla 1.6+ (2.5) has been applied to the component's router class. Specifically, a menu item is always required, and should be coded this way.

 

if (empty($query['Itemid'])) {

$menuItem = $menu->getActive();

} else {

$menuItem = $menu->getItem($query['Itemid']);

}

 

To know how to adapat Joomla 1.5 extensions to Joomla 1.6+ read this document created by Joomla.

Joomla 2.5 follows the coding standards set for Joomla 1.6.

Happy coding!

 

Category: Joomla
blog comments powered by Disqus