User tests: Successful: Unsuccessful:
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.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_content |
Labels |
Added:
?
|
The PR makes sense. Can you provide test instructions to reproduce the php warnings?
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.
I tried and I couldn't get the php warning. I am not sure what I did wrong. I will try again.
@tonypartridge i need clear Instructions to be able for Test.
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.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-22 23:18:48 |
Closed_By | ⇒ | tonypartridge |
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:
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.
@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.
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'])
Status | Closed | ⇒ | Pending |
Closed_Date | 2017-12-22 23:18:48 | ⇒ | |
Closed_By | tonypartridge | ⇒ |
Status | Pending | ⇒ | New |
Closed_Date | 0000-00-00 00:00:00 | ⇒ |
Status | New | ⇒ | Pending |
Set to "open" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/18757
@tonypartridge Since we have a 2nd user/tester with this issue, lets reopen this PR and please do the proposed change. Thanks.
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)
I have tested this item
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!
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
Looks OK here, code review as I have no idea how to reproduce.
@infograf768 can i count your Comment as successful Test and set RTC?
Status | Pending | ⇒ | Ready to Commit |
Ready to Commit after two successful tests.
I have tested this item
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:
?
|
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.