Select Page

Joomla 1.0.9 Invalid argument supplied for foreach() in frontend.php on line 85

Joomla 1.0.9  Invalid argument supplied for foreach() in frontend.php on line 85

  In order to solve  to following issues in #Joomla 1.0.9

Warning: Invalid argument supplied for foreach() in /var/www/vhosts/waltercedric.com/httpdocs/includes/frontend.php on line 85

Edit the file includes/frontend.php , this is the correct code: 

/**
* Cache some modules information
* @return array
*/
function &initModules() {
global $database, $my, $Itemid;

if (!isset( $GLOBALS['_MOS_MODULES'] )) {
$query = "SELECT id, title, module, position, content, showtitle, params"
. "\n FROM #__modules AS m"
. "\n INNER JOIN #__modules_menu AS mm ON mm.moduleid = m.id"
. "\n WHERE m.published = 1"
. "\n AND m.access <= '". $my->gid ."'"
. "\n AND m.client_id != 1"
. "\n AND ( mm.menuid = '".$Itemid."' OR mm.menuid = 0 )"
. "\n ORDER BY ordering";

$database->setQuery( $query );
$modules = $database->loadObjectList();
foreach ($modules as $module) {
$GLOBALS['_MOS_MODULES'][$module->position][] = $module;
}
}
return $GLOBALS['_MOS_MODULES'];
}

In yellow  what has changed in that  method (extract)
. "\n AND m.access <= ‘". $my->gid ."’"
and
. "\n AND ( mm.menuid = ‘".$Itemid."’ OR mm.menuid = 0 )"

All credits goes to user Mathinka (JoomlaPortal.de)

About The Author

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology.In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions.I'm the Founder and CEO of Disruptr GmbH.

Categories