No Code Attached Yet bug
avatar joeforjoomla
joeforjoomla
23 Feb 2025

Steps to reproduce the issue

5.3 beta 1, unpublish the Backward Compatibility Plugin and open a page that does not exist

Expected result

404 page is thrown

Actual result

Class JRouterSite not found.

Setting a tainted URL for an article still call:

public static function getInstance($client, $options = [])
    {
        if (empty(self::$instances[$client])) {
            // Create a Router object
            $classname = 'JRouter' . ucfirst($client);

            if (!class_exists($classname)) {
                throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
            }

            // Check for a possible service from the container otherwise manually instantiate the class
            if (Factory::getContainer()->has($classname)) {
                self::$instances[$client] = Factory::getContainer()->get($classname);
            } else {
                self::$instances[$client] = new $classname();
            }
        }

        return self::$instances[$client];
    }

The class JRouterSite is not found without the Backward Compatibility Plugin enabled, so an exception is thrown.

Image

avatar joeforjoomla joeforjoomla - open - 23 Feb 2025
avatar joomla-cms-bot joomla-cms-bot - change - 23 Feb 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Feb 2025
avatar joeforjoomla joeforjoomla - change - 23 Feb 2025
The description was changed
avatar joeforjoomla joeforjoomla - edited - 23 Feb 2025
avatar joeforjoomla joeforjoomla - change - 23 Feb 2025
The description was changed
avatar joeforjoomla joeforjoomla - edited - 23 Feb 2025
avatar joeforjoomla joeforjoomla - change - 23 Feb 2025
The description was changed
avatar joeforjoomla joeforjoomla - edited - 23 Feb 2025
avatar joeforjoomla joeforjoomla - change - 23 Feb 2025
The description was changed
avatar joeforjoomla joeforjoomla - edited - 23 Feb 2025
avatar richard67
richard67 - comment - 24 Feb 2025

The issue has been reported for 5.3.0-beta1, but from reading code in file libraries/src/Router/Router.php, method getInstance, I would expect it to happen also on 5.2.x.

avatar richard67 richard67 - change - 24 Feb 2025
Labels Added: bug
avatar richard67 richard67 - labeled - 24 Feb 2025
avatar richard67 richard67 - change - 24 Feb 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-02-24 13:32:12
Closed_By richard67
avatar richard67 richard67 - close - 24 Feb 2025
avatar richard67
richard67 - comment - 24 Feb 2025

Closing as having a pull request. Please test #44994 . Thanks in advance.

Hint: For testing with 5.3.0-beta1 the best is to apply the change manually with an editor, as the changed file is not identical with the one in 5.2 so line numbers have changed. But it's the same place within the getInstance method.

Add a Comment

Login with GitHub to post a comment