User tests: Successful: Unsuccessful:
Pull Request resolves #48713 .
When the component router cannot be created (for example a backend-only component that registers a RouterFactory but has no site router class), Route::_() catches the RuntimeException and returns null. The System - SEF plugin did not check for this and called $app->redirect(null, 301), which redirects to the site root and raises Warning: Uninitialized string offset 0 in AbstractWebApplication::redirect().
This PR skips the redirect when Route::_() returns null, both in enforceSEF() (strict routing) and in the tainted URL branch of onAfterRoute(). The request is then handled as it would be with strict routing disabled.
RouterFactory without a site router, e.g. Akeeba Backup or Regular Labs ReReplacer, or the minimal test component attached here (com_routertest.zip).index.php?option=com_routertest&view=json&json=x (or option=com_akeebabackup / option=com_rereplacer).index.php?option=com_users&view=login.Step 3: 301 redirect to the homepage, and Warning: Uninitialized string offset 0 in .../AbstractWebApplication.php is raised.
Step 4: 301 redirect to the SEF URL index.php/component/users/login.
Step 3: no redirect and no warning; the request is handled by the component (the attached test component has no site part, so Joomla shows a 404, same as with Strict Routing = No).
Step 4: unchanged, 301 redirect to the SEF URL.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End Plugins |
| Title |
|
||||||
@exlemor I tested on both github and issues.joomla.org and in both cases I could download the zip file which I attach here again
com_routertest.zip
I have tested this item ✅ successfully on b421d14
I was able to test your PR fix, thanks @shamsbd71.
Thanks @brianteeman for the .zip file.
I have tested this item ✅ successfully on b421d14
I was able to test your PR fix, thanks @shamsbd71.
Thanks @brianteeman for the .zip file.
Hello @shamsbd71, I do not see/cannot find an attached com_routertest.zip component, can you please add it to the PR so that I can test it for you? thank you very much.