? ? Pending

User tests: Successful: Unsuccessful:

avatar tonypartridge
tonypartridge
20 Nov 2017

We assume the array key exists with view but not ID. I have come across some installations where view does not exist and it causes php warnings. So just check it does exist before actually proceeding further as we do with ID.

avatar tonypartridge tonypartridge - open - 20 Nov 2017
avatar tonypartridge tonypartridge - change - 20 Nov 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Nov 2017
Category Front End com_content
avatar tonypartridge tonypartridge - change - 20 Nov 2017
Labels Added: ?
avatar csthomas csthomas - test_item - 20 Nov 2017 - Tested successfully
avatar csthomas
csthomas - comment - 20 Nov 2017

I have tested this item successfully on 45cc426

Code review. The patch works.


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

avatar Quy
Quy - comment - 21 Nov 2017

The PR makes sense. Can you provide test instructions to reproduce the php warnings?

avatar tonypartridge
tonypartridge - comment - 21 Nov 2017

Hey @Quy, it’s an awkward one to test. It’s happened on a few clients sites but not locally. I suspect it may be down to 3rd party components but didn’t spend enough time debugging it, since a simple core check resolves it.

I think personally this can be merged by review, given it is simple just avoid a php warning notice by checking the array key is set before trying to access it.

avatar csthomas
csthomas - comment - 21 Nov 2017

IIRC the issue comes from J1.5 when menu item did not have to have a view. You can simulate it by removing the view parameter (for ex. view=category) from menu link.

See video at #18564

avatar tonypartridge
tonypartridge - comment - 22 Dec 2017

@Quy and @franz-wohlkoenig

Can you test? Remove view=category

For example from a url

Thanks!!

avatar Quy
Quy - comment - 22 Dec 2017

I tried and I couldn't get the php warning. I am not sure what I did wrong. I will try again.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 22 Dec 2017

@tonypartridge i need clear Instructions to be able for Test.

avatar tonypartridge
tonypartridge - comment - 22 Dec 2017

Looks like 3.8.3 may have changed something as I cannot replicate it now. I'll close for now and we can re-do if I or someone else has the issue we can re do with @joomdonation 's comment of all isset in one line.

avatar tonypartridge tonypartridge - change - 22 Dec 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-12-22 23:18:48
Closed_By tonypartridge
avatar tonypartridge tonypartridge - close - 22 Dec 2017
avatar impressionestudio
impressionestudio - comment - 28 Jan 2018

Two days ago I had the same error using Joomla 2.8.3 and I managed to overcome the problem applying the same fix as above.
The error was produced two times because the first time I thought that I did something wrong and restored the website to a previous backup. Then, I did the same actions and the error appeared again.

Steps:

  1. Initially I had 7 menu items of the type "Articles » Single Article".
  2. Then I copied (not moved) them to another menu using the batch process.
  3. Finally I changed the old/initial menu items to the type "Menu Item Alias" that pointed to the new menu items.
    When I tried to access the pages through the last menu items (aliases) some of them were working fine and 2-3 of them had the specific problem.

I believe that the use of the batch process created the problem because I have used menu item aliases many times without problem.

I haven't tried these steps for a third time or to another website.

avatar Quy
Quy - comment - 3 Feb 2018

@impressionestudio Thank you for the detailed steps. I couldn't reproduce the error in v3.8.4. If you can still reproduce it in v3.8.4, please let us know.

avatar impressionestudio
impressionestudio - comment - 5 Feb 2018

I didn't make the steps from the beginning but after I updated from 3.8.3 to 3.8.4 the error appeared again.
So I had to change the code using the fix above.
I believe that this extra line of code that checks if the variable is set must be added. It is a simple check after all.
Furthermore I think that it would be better to check both variables about 'view':

 && isset($menuItem->query['view'], $query['view'])
 && $menuItem->query['view'] == $query['view']
 && isset($menuItem->query['id'], $query['id'])
 && $menuItem->query['id'] == (int) $query['id'])
avatar Quy Quy - change - 5 Feb 2018
Status Closed Pending
Closed_Date 2017-12-22 23:18:48
Closed_By tonypartridge
avatar joomla-cms-bot joomla-cms-bot - change - 5 Feb 2018
Status Pending New
Closed_Date 0000-00-00 00:00:00
avatar joomla-cms-bot joomla-cms-bot - change - 5 Feb 2018
Status New Pending
avatar joomla-cms-bot
joomla-cms-bot - comment - 5 Feb 2018

Set to "open" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/18757

avatar joomla-cms-bot joomla-cms-bot - reopen - 5 Feb 2018
avatar Quy
Quy - comment - 5 Feb 2018

@tonypartridge Since we have a 2nd user/tester with this issue, lets reopen this PR and please do the proposed change. Thanks.


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

avatar tonypartridge
tonypartridge - comment - 25 Mar 2018

Thanks @Quy changes done, can we get some Tests please.

avatar ggppdk
ggppdk - comment - 27 Mar 2018

We assume the array key exists with view but not ID. I have come across some installations where view does not exist and it causes php warnings. So just check it does exist before actually proceeding further as we do with ID.

... Finally I changed the old/initial menu items to the type "Menu Item Alias" that pointed to the new menu items.

Please read description of PR #17271
(Fix com_content legacy router trying to use menu items of other components)

Add my comment in same PR
#17271 (comment)

avatar Chacapamac Chacapamac - test_item - 29 May 2018 - Tested successfully
avatar Chacapamac
Chacapamac - comment - 29 May 2018

I have tested this item successfully on bd5ab16

I try your changes succesfully. I did have an error “Undefined index: view in —> components/com_content/helpers/legacyrouter.php on line 95” when changing from the front page to an inside page/menu under a “Separator” type menu.

No More Warning — Thank You!


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

I retest again - No problems (On Mamp)
Joomla 3.8.8
Php 7.1.2
MYSQL 5.6.38

No apparent error in the browser (Firefox Dev Edition 61.0b9)
No errors in Firefox console
No errors in server PHP-Apache logs

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 29 May 2018

@csthomas can you please retest?

avatar infograf768
infograf768 - comment - 30 May 2018

Looks OK here, code review as I have no idea how to reproduce.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 30 May 2018

@infograf768 can i count your Comment as successful Test and set RTC?

avatar infograf768
infograf768 - comment - 30 May 2018

Yes. In any case @mbabker will check code and see it makes sense.

avatar franz-wohlkoenig franz-wohlkoenig - alter_testresult - 30 May 2018 - infograf768: Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 May 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 30 May 2018

Ready to Commit after two successful tests.

avatar csthomas
csthomas - comment - 30 May 2018

I have tested this item successfully on bd5ab16


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

avatar csthomas csthomas - test_item - 30 May 2018 - Tested successfully
avatar mbabker mbabker - change - 2 Jun 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-06-02 15:34:27
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 2 Jun 2018
avatar mbabker mbabker - merge - 2 Jun 2018

Add a Comment

Login with GitHub to post a comment