RTC Release Blocker bug PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
24 Feb 2025

Pull Request for Issue #44990 .

Summary of Changes

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.

Testing Instructions

See issue #44990 .

Actual result BEFORE applying this Pull Request

See issue #44990 .

Expected result AFTER applying this Pull Request

No such issue with the router.

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

avatar richard67 richard67 - open - 24 Feb 2025
avatar richard67 richard67 - change - 24 Feb 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Feb 2025
Category Libraries
avatar richard67 richard67 - change - 24 Feb 2025
The description was changed
avatar richard67 richard67 - edited - 24 Feb 2025
avatar HLeithner
HLeithner - comment - 24 Feb 2025

Technically this is a b/c break, I would check first if the JRouterXXX class exists if not fall back to the namespaced version.

avatar richard67
richard67 - comment - 24 Feb 2025

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?

avatar HLeithner
HLeithner - comment - 24 Feb 2025

would mean it's broken until eol of 5.4... Just add your code as fallback into the if statement, that should be ok.

avatar richard67 richard67 - change - 24 Feb 2025
Labels Added: bug PR-5.2-dev
avatar richard67
richard67 - comment - 24 Feb 2025

Done.

avatar richard67 richard67 - change - 24 Feb 2025
The description was changed
avatar richard67 richard67 - edited - 24 Feb 2025
avatar richard67 richard67 - change - 24 Feb 2025
Title
[5.2] Do not use deprecated JRouter alias in core
[5.2] Fall back to full qualified class name if JRouter alias is not available
avatar richard67 richard67 - edited - 24 Feb 2025
avatar richard67 richard67 - change - 14 Mar 2025
Title
[5.2] Fall back to full qualified class name if JRouter alias is not available
[5.3] Fall back to full qualified class name if JRouter alias is not available
avatar richard67 richard67 - edited - 14 Mar 2025
avatar richard67 richard67 - change - 14 Mar 2025
Labels Added: PR-5.3-dev
avatar richard67 richard67 - change - 14 Mar 2025
The description was changed
avatar richard67 richard67 - edited - 14 Mar 2025
avatar richard67 richard67 - change - 14 Mar 2025
Labels Removed: PR-5.2-dev
avatar Fedik
Fedik - comment - 1 Apr 2025

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

->alias('JRouterSite', SiteRouter::class)

avatar richard67
richard67 - comment - 1 Apr 2025

A better fix would be to check also container

@Fedik I see. Do you want to make a PR? IF yes, I will close this one here in favour of yours.

avatar Fedik
Fedik - comment - 1 Apr 2025

I am good if you copy my suggestion 😄

avatar richard67
richard67 - comment - 1 Apr 2025

I am good if you copy my suggestion 😄

Ok, I will do that and adjust title and description. Thanks for the suggestion.

avatar richard67
richard67 - comment - 1 Apr 2025

@Fedik I've slightly modified your suggestion. I hope it's still fine.

avatar richard67 richard67 - change - 1 Apr 2025
Title
[5.3] Fall back to full qualified class name if JRouter alias is not available
[5.3] Fix check for JRouter class alias to work with b/c plugin switched off
avatar richard67 richard67 - edited - 1 Apr 2025
avatar richard67 richard67 - change - 1 Apr 2025
The description was changed
avatar richard67 richard67 - edited - 1 Apr 2025
avatar richard67 richard67 - change - 1 Apr 2025
The description was changed
avatar richard67 richard67 - edited - 1 Apr 2025
avatar richard67 richard67 - change - 2 Apr 2025
Labels Added: Release Blocker
avatar joomdonation joomdonation - test_item - 2 Apr 2025 - Tested successfully
avatar joomdonation
joomdonation - comment - 2 Apr 2025

I have tested this item ✅ successfully on a23007a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44994.

avatar joomdonation
joomdonation - comment - 2 Apr 2025

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

avatar richard67 richard67 - alter_testresult - 2 Apr 2025 - joomdonation: Tested successfully
avatar exlemor exlemor - test_item - 2 Apr 2025 - Tested successfully
avatar exlemor
exlemor - comment - 2 Apr 2025

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

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


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44994.
avatar richard67
richard67 - comment - 2 Apr 2025

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.

avatar richard67 richard67 - change - 2 Apr 2025
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 2 Apr 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44994.

avatar bembelimen bembelimen - change - 2 Apr 2025
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
avatar bembelimen bembelimen - close - 2 Apr 2025
avatar bembelimen bembelimen - merge - 2 Apr 2025
avatar bembelimen
bembelimen - comment - 2 Apr 2025

Thx

Add a Comment

Login with GitHub to post a comment