?
avatar Vednier
Vednier
5 May 2017

Steps to reproduce the issue

Install or update Joomla! to version 3.7

Expected result

Everything is fine

Actual result

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

System information (as much as possible)

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

Additional comments

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.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar Vednier Vednier - open - 5 May 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 May 2017
avatar Vednier
Vednier - comment - 5 May 2017

Example of problem screen shot 2017-05-05 at 00 28 18


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15823.

avatar ggppdk
ggppdk - comment - 5 May 2017

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

avatar ggppdk
ggppdk - comment - 5 May 2017

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

avatar piotr-cz
piotr-cz - comment - 5 May 2017

The original patch is here: 64f5ac9 just the file is called now legacyrouter.php

@Vednier to check if that fixes the issue you may try to apply patch manually

avatar Vednier
Vednier - comment - 5 May 2017

@piotr-cz - yes, this little fix stop notices from appearing in ErrorLog. Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15823.

avatar franz-wohlkoenig franz-wohlkoenig - change - 9 May 2017
Status New Discussion
avatar brianteeman
brianteeman - comment - 18 Aug 2017

Closed as there is a PR for testing

avatar brianteeman brianteeman - change - 18 Aug 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-08-18 10:46:52
Closed_By brianteeman
avatar brianteeman brianteeman - close - 18 Aug 2017
avatar guidedwebsitedesign
guidedwebsitedesign - comment - 12 Jan 2018

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.

avatar impressionestudio
impressionestudio - comment - 26 Jan 2018

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'].


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15823.

avatar Quy
Quy - comment - 27 Jan 2018

@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.

Add a Comment

Login with GitHub to post a comment