-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[5.2] SEF/Router: Only merge default menu item when same component #43164
Conversation
should'nt this be backported to 4.4 ? as per #43154 |
I have tested this item ✅ successfully on 773a13f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
I'm unsure how this should be handled and asked the cms maintainer group about this. waiting for their feedback. |
Co-authored-by: Harald Leithner <leithner@itronic.at>
I have tested this item ✅ successfully on 8accc62 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
….2-router-default
…to 5.2-router-default
Surely having to change an existing test that passes without this PR in order for it to pass with this PR is a red flag that something is wrong with this PR |
Good to get this bug fixed! It shouldn't merge in the parameters of the home menuitem. However, the code is now not setting the active menuitem. This is a problem as extension developers do use this. In Joomla 3.x the active menuitem wasn't set in the case of the home menuitem being used as default. Then in Joomla 4 it changed to being set. So in my opinion we shouldn't be now changing it back to the case where it's not set. If the balance of opinion is that it shouldn't be set then this side-effect needs to be clearly highlighted in the documentation of the pull request. See https://docs.joomla.org/Menu_and_Menuitems_API_Guide#Active_Menu_Item and |
Thank you @robbiejackson. Your comment made me check this again and do a debugging session of several hours and after several checks I indeed agree that we should still set the active menu item. I changed the code accordingly. Good catch. Our code actually states that getActive() might return null when no menu item is set, but who reads docblocks? ;-) |
@uGE70, @SniperSister, @robbiejackson could you test this again so that we hopefully can merge this into 5.2? Thank you! |
I have tested this item ✅ successfully on 359bbde This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
I have tested this item ✅ successfully on 359bbde I'll update the joomla manual documentation to confirm that the menuitem is now always set. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
@robbiejackson this is actually something which I would keep vague for now. The getActive() method states that it can also return null and I'm currently still considering it to be more correct to not set the menu item in this case. However that would be a b/c break and thus has to wait until at least 6.0. |
Thanks for the tests! |
I have tested this item ✅ successfully on bfa035f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
1 similar comment
I have tested this item ✅ successfully on bfa035f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43164. |
This fixes issues #43154, #35463 and #39149
Summary of Changes
The router right now merges the query elements of the current menu item into the query it parsed so far. If no menu item was found, it merges in the values of the default menu item. This is quite a problem when the default menu item contains query elements which are not overwritten by the URL itself. One example would be our own schedule runner plugin with a default menu item linking to an article. This PR only merges in the menu items query when the menu item and the parsed option are identical. Most likely this doesn't solve the issue entirely, since you could have a component which still could fail in this constellation, but at least it wouldn't fail anymore for all the components out there which currently have the query from an article default menu item merged into their request.
Testing Instructions
var_dump($id);die;
to line 206Actual result BEFORE applying this Pull Request
The var_dump() returns a non-zero ID, even though there is no ID in the URL.
Expected result AFTER applying this Pull Request
The var_dump() correctly only returns a 0.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed