Install or update Joomla! to version 3.7
Everything is fine
A lot of Notice: Undefined index: id in ... /components/com_content/helpers/legacyrouter.php on line 97 strings in server ErrorLog
If Notice frontend reporting is not disabled they fill site pages as well, like here - http://www.degtyarsk.ru/component/content/featured.html?start=180
Ubuntu 16.04, Apache 2.4.18, php 7.0.15, MySQL 5.7.18
Personally i use Flexicontent 3.1.1 but i still have this problem
I made some search over internet and it looks that this problem is fairly common - https://duckduckgo.com/?q=com_content%2Fhelpers%2Flegacyrouter.php+on+line+97&t=midori&ia=web
All sites showing this problem have README.txt with Joomla 3.7 version. They dont seem to use Flexi so i think problem within Joomla itself.
The bug is totally unrelated to FLEXIcontent
It is a known joomla bug,
and it is not new to J3.7 it existed before, just it occured in a different file (the code producing it was moved to another file)
The com_content (legacy) router under some cases (the view variable matches, etc) tries to "examine" menu items that belong to other components !!
In the end these menu items are not selected but in the middle of the code they are examined as if they are com_content menu items
... and you get these notices
Quick solution: disable error reporting in global config you do not need / should not enable it in a live site
See a long discussion here
#6488
A bug that should have been fixed when that PR was still good
Still a simpler / easy fix is possible, with no risk for break (just for the sake of not changing the broken code) by using an isset statement on the id index of the menu
And to make it clear, it is always not a harmless bug, if a menu item of different component is found that has a matching number in the id then it will be selected, to be used for creating a com_content URL using a menu item of different component
@piotr-cz - yes, this little fix stop notices from appearing in ErrorLog. Thanks.
Status | New | ⇒ | Discussion |
Closed as there is a PR for testing
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-08-18 10:46:52 |
Closed_By | ⇒ | brianteeman |
I accidentally caused this error to display on my own site when I copied the url of an existing page on my site and used it in a menu item of type URL. I published the menu item and I removed the symptom.
I use Joomla 3.8.3 and I have the same problem. The problem appeared when I created many menu items of the type "Menu Item Alias" that point to other menu items of the type "Articles ยป Single Article".
I managed to fix the problem by changing the line 95 in "components\com_content\helpers\legacyrouter.php" from:
if ($menuItem !== null
&& $menuItem->query['view'] == $query['view']
&& isset($menuItem->query['id'], $query['id'])
&& $menuItem->query['id'] == (int) $query['id'])
to:
if ($menuItem !== null
&& isset($menuItem->query['view'])
&& $menuItem->query['view'] == $query['view']
&& isset($menuItem->query['id'], $query['id'])
&& $menuItem->query['id'] == (int) $query['id'])
Actually I added the line:
&& isset($menuItem->query['view'])
It seems that they forgot to check the existence of the variable $menuItem->query['view'].
@impressionestudio There is a closed PR #18757 to fix this. Please provide exact steps/instructions on how to reproduce it in v3.8.3 so that it can be tested/merged. Thanks.
Example of problem
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15823.