1: Enable Joomla SEF.
2: Create a simple system plugin, and inside onAfterRoute
add the following code:
function onAfterRoute() {
$uri = JURI::getInstance();
$uriparams = JFactory::getApplication()->getRouter()->parse($uri);
var_dump($uriparams);
}
Go to any com_users link (eg. /index.php/component/users/registration)
Display an array of URL query parameters.
Throws an error from JROOT/libraries/src/Router/Router.php:153
Joomla 4 alpha12 PHP 7.3
The error happens only on links generated by com_users (com_content and my own extension links etc work).
It only happens when its SEF URL is used. eg https://www.domain.com/index.php/component/users/registration?Itemid=101
Accessing the page using non-SEF URL does not trigger the error. eg https://www.domain.com/index.php?option=com_users&view=registration&Itemid=101
works as expected.
Labels |
Added:
?
|
Please test the nightly builds to see if this is still an issue.
https://developer.joomla.org/nightly-builds.html
Hi Quy
Updated to the beta1-dev and the same error occurs. Also tried incognito mode and another browser to make sure it's not a session/cookie issue, same error too.
Really excited beta is next to release!
without much info about the 3dp plugin "parainvite" should be hard to guess
Hi Alikon
I stripped out everything in the plugin with just the code in the original post, it's still the same.
The reason for this is that the parse detects com_content based on Itemid 101 and ignores com_users and registration. is not part of com_content and the error occur...
The Url:
http://example.com/joomla-cms/index.php/component/users/remind?Itemid=101
Ends in:
object(Joomla\CMS\Uri\Uri)#125 (10) {
["uri":protected]=>
string(76) "http://example.com/joomla-cms/index.php/component/users/remind?Itemid=101"
["scheme":protected]=>
string(4) "http"
["host":protected]=>
string(14) "example.com"
["port":protected]=>
NULL
["user":protected]=>
NULL
["pass":protected]=>
NULL
["path":protected]=>
string(6) "remind"
["query":protected]=>
NULL
["fragment":protected]=>
NULL
["vars":protected]=>
array(3) {
["option"]=>
string(11) "com_content"
["view"]=>
string(8) "featured"
["Itemid"]=>
int(101)
}
}
After processParseRules in Router is called. Maybe @Hackwar can help here?
The Itemid with the menu item is higher rated then the override of the url, not sure if this is expected behavior, I don't think so
As mentioned the Itemid 101 is per default the menu item for featured articles. You see this in the 'vars' entry of the uri object.
If you create a menu item for com_users this should fix your problem too but not the root of the problem.
Hi HLeithner
So sorry I deleted my reply before I saw your reply. I found a link that's actually for com_content > featured, which is the default Home. I unpublished that but it didn't help. The next link on the menu threw the same error.
With regards to your reply, removing the Itemid parameter from the URL didn't help either. The registration link itself does not have a menu item attached to it, it's just using standard Joomla SEF rewrite.
If you create a menu item for com_users this should fix your problem too but not the root of the problem.
Yes you're right, I just tried it and it works. I understand the bug now. Without a menu item attached to the component, the Router overrides it with the Itemid of another menu item and assumes its path.
Status | New | ⇒ | Confirmed |
Please test this again. I can not replicate this right now.
Based on comments above and the lack of response for a year I assume this is resolved?
The issue is still there in today Joomla 4 night build.
I looked into this again and the issue is, that after the initial parse, the active menu item is set to the default menu item. So now, when parse is called a second time on the component router, it simply looks up the active menu item and thus the default menu item is taken. That again means that the nomenu rule doesn't think it is responsible here and returns without parsing the URL.
Unfortunately there is next to nothing we can do about this. While the application router actually knows that it didn't find a menu item for this URL, the component router never gets this information and without a B/C break, we can't provide this to the component router.
We would have the possibility to throw quite a lot of code at this to get around this, requiring third party devs to update their routers as well if they want to get around this problem. All of this code would have to be deprecated right again as well, because we would have to fix this properly in 5.0 then. It would be a big headache for everyone. I'm against doing this.
For this specific situation here, the solution would actually be far simpler. Instead of parsing the current URL again, just do $uriparams = JFactory::getApplication()->getRouter()->getVars()
and you got the result of that call for the current URL.
Long story short: I would vote to close this issue and mark it as "Needs review for 5.0".
At a minimum it should be documented as a known issue
I have just updated one of my oldest web sites first created in Joomla 1.5 and updated right through to 4. However, everything is working apart from when the Smart Search renders the articles, when I click on them I get the Requested page cannot be found. JROOT/libraries/src/Router/Router.php:153
My other issue if I may post here is in administrator > Joomla Update I get this error message: https://prnt.sc/rZuXhZ7C1vDl
To be so close to updating this site to Joomla 4 is very frustrating and any help would be appreciated. www.adventgroup.org.uk
Labels |
Added:
No Code Attached Yet
bug
Removed: ? |
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-29 10:55:46 |
Closed_By | ⇒ | Hackwar |
thats all? it just says error and the line - nothing else?