Fix com_content legacy router trying to use menu items of other components#17271
Fix com_content legacy router trying to use menu items of other components#17271ggppdk wants to merge 2 commits intojoomla:stagingfrom
Conversation
|
Please note that the picture is old (it shows same notice in different PHP file), because this is the 3rd PR to made, the other had conflicts after the legacy router being moved, and we closed them |
| // Check again | ||
| if ($menuItemGiven && isset($menuItem) && $menuItem->component != 'com_content') | ||
| // Make sure that the menu item selected above actually points to com_content component | ||
| if (!empty($menuItem) && $menuItem->component != 'com_content') |
There was a problem hiding this comment.
Can you change above line to if ($menuItem !== null && $menuItem->component != 'com_content')?
|
I have tested this item ✅ successfully on 6f792c4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17271. |
|
@Quy Code review? |
@infograf768 It was fixed in #18564 |
|
This PR is not related to the particular case that you linked it seems to me that @csthomas PR mentioned above is fixing that particular issue mentioned in the forum |
|
But if this PR is merged maybe the issue in the forum will be fixed too
|
|
Thinking of it more, but the original reason of it |
|
Because of joomla-cms/libraries/src/Component/Router/Rules/MenuRules.php Lines 167 to 173 in 54eb5d8 for now But if we comment above lines and create a new component with article view, then URL routing for It is illogical to unset joomla-cms/components/com_content/helpers/legacyrouter.php Lines 65 to 81 in 54eb5d8 BTW. It would be nice to replace all occurrences of |
|
The PR above removed the notice when comparing to menu items and then there is this PR to clean the notice of non set view variable in the menu item when comparing
would just not try to match a menu item that is of a different component then all these notices would not need to be cleaned (assuming you then make comparison in correct order, aka first the view and then the id) so Instead of addressing a route issue we suppress the notices so that we can compare with menu items that are clearly not a match because are of wrong component and if you ever succeed to make a match (since we ignored that they are menu items of different component) then the URL when clicked will be broken |
|
I’m not to sure how to participate but I was invited to do it here. I test a fix from “impressionestudio” on #15823 that work perfectly by inserting this line of code No more errors. I was wondering if this is the right fix ? — Sorry, I’m learning how Github work, be patient with me... |
|
@Chacapamac please test this pull request to see if it will fix your issue. |
|
From Quy > @Chacapamac please test this pull request to see if it will fix your issue. |
|
PR #17271 that you are on. |
|
I guess I go in “Files Changed” Passing from front page to inside page give me again the Error: Again, adding |
|
@Chacapamac Please test #18757 and mark your test result at the issue traker: https://issues.joomla.org/tracker/joomla-cms/18757 |
|
If i remember correctly, (without retesting) i think it was resolved elsewhere, closing |
Pull Request for Issues #15823
com_content router will only check if menu item is of 'com_content' type only if "menuItemGiven" flag is set, but this is not enough
The result is that current menu item can be tried without caring if it is com_content menu item
Summary of Changes
Always check if selected menu item is
Testing Instructions
Code review
Also an example for testing is shown here:
2 .Unpublish ALL com_content menu items
Result is shown here
https://cloud.githubusercontent.com/assets/5092940/17293281/0f36a64a-57f8-11e6-8ae2-3012187cb7ea.png
Expected result
The current menu item since it belongs to other component should not be examined by the com_content router
Actual result
The com_content router tries to use the menu item
Documentation Changes Required