My Apache log is full of notices like the following:
[Sun Aug 11 09:11:36 2013] [error] [client 127.0.0.1] PHP Notice: Undefined index: view in /var/www/components/com_content/router.php on line 59
Here's the referenced bit of code:
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == (int) $query['id'])ug
{
unset($query['view']);
if (isset($query['catid']))
{
unset($query['catid']);
}
if (isset($query['layout']))
{
unset($query['layout']);
}
unset($query['id']);
return $segments;
}
From what I've read, the isset is the most common solution for this, but it's not making a difference. Anyone else come across a solution?
Move the isset()
check to right after the stdClass
check.
In other words, change
($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == (int) $query['id'])
to
($menuItem instanceof stdClass) && isset($query['id']) && $menuItem->query['view'] == $query['view'] && $menuItem->query['id'] == (int) $query['id'])
You're referring to a view
index in both $menuItem->query
and $query
and PHP complains about Undefined index: view
, so I assume one or both of those variables doesn't have a view
index.