Skip to content

Commit a3b6278

Browse files
authored
[5.3] Fix check for JRouter class alias to work with b/c plugin switched off (joomla#44994)
1 parent b3f9f32 commit a3b6278

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

libraries/src/Router/Router.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,13 @@ public static function getInstance($client, $options = [])
121121
// Create a Router object
122122
$classname = 'JRouter' . ucfirst($client);
123123

124-
if (!class_exists($classname)) {
125-
throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
126-
}
127-
128-
// Check for a possible service from the container otherwise manually instantiate the class
124+
// Check for a possible service from the container, otherwise manually instantiate the class if it exists
129125
if (Factory::getContainer()->has($classname)) {
130126
self::$instances[$client] = Factory::getContainer()->get($classname);
131-
} else {
127+
} elseif (class_exists($classname)) {
132128
self::$instances[$client] = new $classname();
129+
} else {
130+
throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
133131
}
134132
}
135133

0 commit comments

Comments
 (0)