User tests: Successful: Unsuccessful:
Pull Request for Issue #44990 .
This pull request (PR) fixes the check for the JRouter
class alias existing in the getInstance
method of the Joomla\CMS\Router\Router
class so it does not fail with false alarm when the service from the container is used and the b/c plugin is switched off.
See issue #44990 .
See issue #44990 .
No such issue with the router.
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Technically this is a b/c break, I would check first if the JRouterXXX class exists if not fall back to the namespaced version.
@HLeithner Well, I just see that the complete getInstance method is deprecated anyway and will be removed with 6.0, so maybe leave it as it is and close this PR?
would mean it's broken until eol of 5.4... Just add your code as fallback into the if statement, that should be ok.
Labels |
Added:
bug
PR-5.2-dev
|
Done.
Title |
|
Title |
|
Labels |
Added:
PR-5.3-dev
|
Labels |
Removed:
PR-5.2-dev
|
A better fix would be to check also container, kind of:
$classname = 'JRouter' . ucfirst($client);
if (!Factory::getContainer()->has($classname) && !class_exists($classname)) {
throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
}
Instead of building class-name.
The Router service already have an alias to JRouterSite
I am good if you copy my suggestion 😄
I am good if you copy my suggestion 😄
Ok, I will do that and adjust title and description. Thanks for the suggestion.
Title |
|
Labels |
Added:
Release Blocker
|
I have tested this item ✅ successfully on a23007a
In theory, the check for namespace class is missing in this PR, but adding the check might make the code unnecessary complicated because in real life, the router is available in the container already. That's why I give this PR a success test
I have tested this item ✅ successfully on 726f3bd
I was able to successfully confirm going from 500 - Unable to load router: site to 404 - Page not found.
I should point out that with Debug: on, Error Reporting: Maximum, there is additional info not mentioned in PR:
404 - Page not Found
Call Stack
1 () JROOT/libraries/src/Router/Router.php:166
2 Joomla\CMS\Router\Router->parse() JROOT/libraries/src/Application/SiteApplication.php:767
3 Joomla\CMS\Application\SiteApplication->route() JROOT/libraries/src/Application/SiteApplication.php:243
4 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:304
5 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
6 require_once() JROOT/index.php:32
I should point out that with Debug: on, Error Reporting: Maximum, there is additional info not mentioned in PR:
404 - Page not Found
Call Stack
Function Location
1 () JROOT/libraries/src/Router/Router.php:166 2 Joomla\CMS\Router\Router->parse() JROOT/libraries/src/Application/SiteApplication.php:767 3 Joomla\CMS\Application\SiteApplication->route() JROOT/libraries/src/Application/SiteApplication.php:243 4 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:304 5 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58 6 require_once() JROOT/index.php:32
Yes, that is thrown here by the CMS itself, not by PHP: https://github.com/joomla/joomla-cms/pull/44994/files#diff-725497212f99c4aa5ed89d29690eedce8a89eb405676487ee1b81074a2afe950R165-R167
That does not change with this PR.
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-04-02 22:03:12 |
Closed_By | ⇒ | bembelimen | |
Labels |
Added:
RTC
|
Thx
Technically this is a b/c break, I would check first if the JRouterXXX class exists if not fall back to the namespaced version.