No Code Attached Yet J3 Issue
avatar tonypartridge
tonypartridge
26 Oct 2017

Steps to reproduce the issue

New router and remove ids

Create two menu items:

  1. Blog - A Blog view
  2. Guides with a parent of blog - A single article view

Create 1 Category called Guides so the sub menu item of Blog has the same alias as the Category.

Create an article in the Guides category and view the blog View Menu Item. Click your new Article from this item and it will 404 error since it is trying to use the sub menu item in the URL.

Expected result

Works withgout error

Actual result

404 error

avatar tonypartridge tonypartridge - open - 26 Oct 2017
avatar joomla-cms-bot joomla-cms-bot - change - 26 Oct 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Oct 2017
avatar tonypartridge tonypartridge - change - 26 Oct 2017
The description was changed
avatar tonypartridge tonypartridge - edited - 26 Oct 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Oct 2017
Category Router / SEF
avatar mbabker
mbabker - comment - 26 Oct 2017

I'd almost call that expected behavior that it can't correctly route. In this scenario you are essentially creating two items with the same expected URI structure (/blog/guides).

avatar tonypartridge
tonypartridge - comment - 26 Oct 2017

True, it’s not my doing. But it shouldn’t try to route through a menu item which is not capable of displaying the item. In this case a single article menu item.

On 26 Oct 2017, 14:52 +0100, Michael Babker notifications@github.com, wrote:

I'd almost call that expected behavior that it can't correctly route. In this scenario you are essentially creating two items with the same expected URI structure (/blog/guides).

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar mbabker
mbabker - comment - 26 Oct 2017

The bug is deeper than the routing, the routing just exposes it. You shouldn't be allowed to create content whose resolved URIs would be duplicated in general.

You can't expect the router to know what to do if it does the processing for a URI and it results in finding two configurations that could handle the route. It should raise an error (like it does now, intentional or not) because it could not resolve a unique content item.

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Oct 2017
Status New Discussion
avatar csthomas
csthomas - comment - 26 Oct 2017

@tonypartridge

If you like ugly hack then you can use:

diff --git a/libraries/src/Component/Router/Rules/StandardRules.php b/libraries/src/Component/Router/Rules/StandardRules.php
index f8b2c2544e..37a14e47f2 100644
--- a/libraries/src/Component/Router/Rules/StandardRules.php
+++ b/libraries/src/Component/Router/Rules/StandardRules.php
@@ -79,6 +79,16 @@ class StandardRules implements RulesInterface
                        return;
                }
 
+               if ($segments && !$views[$vars['view']]->children && !$views[$vars['view']]->nestable)
+               {
+                       // Fall back to parent of active
+                       array_unshift($segments, $active->alias);
+                       $active = $this->router->menu->getItem($active->parent_id);
+                       $vars['view'] = $active->query['view'];
+                       $vars['id'] = $active->query['id'];
+                       $this->router->menu->setActive($active->id);
+               }
+
                // Copy the segments, so that we can iterate over all of them and at the same time modify the original segments
                $tempSegments = $segments;
avatar tonypartridge
tonypartridge - comment - 31 Oct 2017

Thanks thomas, for me I can work around it. It’s not a big deal, but for sure integrators and end users they simply will not understand why it’s not working. And a negative hit for us again.

We need to prevent this from happening or advise on why it’s a 404? Personally I would expect the core to look for an alternative if it was a 404 for instance..

avatar Sophist-UK
Sophist-UK - comment - 30 Dec 2017

I would certainly like to see diagnostic information displayed if JDEBUG is on rather than a 404 or a "You are not authorised to view this resource."


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

avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
3.8 New SEF Router - Bug
New SEF Router - Bug
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar brianteeman
brianteeman - comment - 23 Aug 2022

Thank you for raising this issue.

Joomla 3 is now in security only mode with no further bug fixes or new features.

As this issue doesn't relate to Joomla 4 it will now been closed.

If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24

avatar zero-24 zero-24 - change - 23 Aug 2022
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 13:47:50
Closed_By zero-24
Labels Added: No Code Attached Yet
Removed: ?
avatar zero-24 zero-24 - close - 23 Aug 2022

Add a Comment

Login with GitHub to post a comment