-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.1] Gettting the router should not be static #36562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
|
I agree that it's wrong. But it's also a fairly painful b/c break to resolve :( I can't remember the details or discussions - but I remember having to just end up fixing all the current method calls way back #3548 - this was just due to a phpunit upgrade. but i'm sure there was a conversation about making it non-static again too somewhere. https://developer.joomla.org/joomlacode-archive/issue-33688.html?highlight=WzMzNjg4XQ== I assume we'll have strict errors again after this in the places I changed above (if they still exist - it's possible with the new router lots of that stuff was cleaned up...) but even if we fix them we still have to account for 3rd party plugins doing similar things :( Thinking things like SH404 or other such extensions that overload bits of the router. Overall completely agree it shouldn't be static. It just might need to be a 5.0 fix :( |
|
So we have already strict errors right now. Should we fix it in 4 and then in 5 revert to none static? |
Co-authored-by: Phil E. Taylor <[email protected]>
Co-authored-by: Phil E. Taylor <[email protected]>
Co-authored-by: Phil E. Taylor <[email protected]>
Co-authored-by: Phil E. Taylor <[email protected]>
|
Closing in favor of #36688. |
Summary of Changes
The
getRouterfunction is still static in the application classes, but it is used in core on instances. Example is here https://github.com/joomla/joomla-cms/blob/4.1-dev/libraries/src/Router/Route.php#L133.This pr removes the static call as applications can have different implementations and the router of the application should always be accessed on the instance and not statically.
It became static 13 years ago in 7175d2f. Time to revert it as we do not work anymore on static application access, more on the instance itself.
This can be considered a BC break but in my eyes, it is a wrong implementation.
cc: @wilsonge
Testing Instructions
Open the front end and back end.
Actual result BEFORE applying this Pull Request
All is working.
Expected result AFTER applying this Pull Request
All is working.