?
avatar joeforjoomla
joeforjoomla
16 Apr 2016

Steps to reproduce the issue

For components implementing the new routing linked to menu items, all menu items links are broken when executing Joomla with raw URLs or URLs not routed to any menu items such as 'component/contact'

Expected result

Opening a Joomla link such as http://www.domain.com/component/contact, http://www.domain.com/component/tags or using a raw link such as a link to generate a sitemap http://www.mysite.com/index.php?option=com_osmap&view=xml&tmpl=component&id=1
will result in all Joomla menu items links broken if the linked component implements the new view based router.

Actual result

All links are broken, they don't stay the same as when clicking on a menu item having an alias.
Appending a casual alias before the raw link, even if a not existent alias, all links are generated again correctly.
http://www.mysite.com/randomstringalias/index.php?option=com_osmap&view=xml&tmpl=component&id=1

System information (as much as possible)

Testing Joomla 3.6 dev branch

Additional comments

avatar joomlajoe joomlajoe - open - 16 Apr 2016
avatar chrisdavenport
chrisdavenport - comment - 16 Apr 2016

I can't seem to reproduce this issue. Can you give me the exact steps you took, starting from a fresh install with default sample data, that lead to getting broken links?

avatar brianteeman brianteeman - change - 17 Apr 2016
Labels Added: ?
avatar chrisdavenport
chrisdavenport - comment - 17 Apr 2016

@joomlajoe See #9953

Is that the problem you are reporting here?

avatar brianteeman brianteeman - change - 17 Apr 2016
Category Router / SEF
avatar roland-d
roland-d - comment - 17 Apr 2016

@joomlajoe Is this using the 3.6 branch?

Notifying @hackwar

avatar joomlajoe
joomlajoe - comment - 17 Apr 2016

Yes i found the exact line to fix the issue.

It's happening in the JComponentRouterRulesMenu preprocess function.
Code at line 125 set the default Itemid overwriting the one in $query array already present:

    if (!empty($default->id))
    {
        $query['Itemid'] = $default->id;
    }

to fix the issue this should be changed as following:

    if (!empty($default->id) && empty($query['Itemid']))
    {
        $query['Itemid'] = $default->id;
    }

Please notify @Hackwar

To reproduce this it's easy, i just installed a 3.6 branch with few sample data. Navigating menu and observing menu links everything is ok.
Trying to open a link such as http://test36/component/contact, etc and observing menu links you will notice they are broken in most cases, for example always pointing to the home page or: http://test36/en/component/users/?Itemid=101

avatar brianteeman brianteeman - change - 10 May 2016
Milestone Added:
avatar brianteeman brianteeman - change - 10 May 2016
Milestone Added:
avatar crazynex
crazynex - comment - 9 Jul 2016

Hi In my joomla 3.5.1 error logs I too get the following.
PHP Warning: array_merge(): Argument #2 is not an array in public_html/libraries/cms/router/router.php on line 350
PHP Fatal error: Unsupported operand types in public_html/libraries/cms/router/router.php on line 234
Is the above code a fix for this error and if so where exactly does it go.

avatar Hackwar
Hackwar - comment - 10 Jul 2016

@crazynex No, this has nothing to do with your issue. That code is not active yet and your issue will have a different source.

@joeforjoomla The code is the same as we have in Joomla right now. The issue looks more like a configuration issue on your end.

avatar wilsonge
wilsonge - comment - 10 Sep 2016

I can no longer replicate this on the 3.7 branch. On my local copy going to http://localhost/~george/joomla-cms/component/content and http://localhost/~george/joomla-cms/component/tags and both perfectly accessible

I can also access http://localhost/~george/joomla-cms/index.php?option=com_content&view=article&id=1 without issues

I'm going to close this issue. If you can replicate it please feel free to and provide a bit more information!

avatar wilsonge wilsonge - change - 10 Sep 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-09-10 20:55:16
Closed_By wilsonge
avatar wilsonge wilsonge - close - 10 Sep 2016
avatar joeforjoomla
joeforjoomla - comment - 11 Sep 2016

I currently tested again but the issue is still there in the 3.7 dev https://developer.joomla.org/nightlies/Joomla_3.7.0-dev-Development-Full_Package.zip
Let me know if i should test another branch.

By the way the problem is not about accessing pages as you say; http://localhost/~george/joomla-cms/component/tags

The problem is that if a page link is not routed to any menu item all links from components using the new router or even not using the new router generated by Joomla menus are broken.

See self explaining screenshots below, accessing normal page link with a routed menu item alias like http://joomla37/en/about you see that the log out menu item has correct link: http://joomla37/en/log-out
broken_links1

Accessing normal page link without a routed menu item alias like http://joomla37/en/component/tags you see that the log out menu item has broken link: http://joomla37/en/component/users/?Itemid=101
broken_links2

Let me know if i should test another branch, also notice that i provided a fix for this issue months ago.

avatar wilsonge wilsonge - change - 11 Sep 2016
Status Closed New
Closed_Date 2016-09-10 20:55:16
Closed_By wilsonge
avatar wilsonge wilsonge - reopen - 11 Sep 2016
avatar wilsonge
wilsonge - comment - 11 Sep 2016

Ahh ok I understand now. Thanks for the screenshots! That helps a lot!

avatar joeforjoomla
joeforjoomla - comment - 11 Sep 2016

You are welcome George, happy to help if possible :)
I just tested again everything and i can confirm that the issue is still there!
PS: should be marked as release blocked i think

avatar wilsonge wilsonge - change - 11 Sep 2016
Labels Added: ?
avatar joeforjoomla
joeforjoomla - comment - 11 Sep 2016

A couple of other screenshots that my be helpful too, routed page link for xmap/osmap sitemap all links ok:
links ok

Not routed page link, several links go wrong:
links ko

avatar wilsonge
wilsonge - comment - 12 Sep 2016

OK PR #12020 - this is effectively your code change but slightly further up the file

avatar wilsonge wilsonge - close - 12 Sep 2016
avatar wilsonge wilsonge - close - 12 Sep 2016
avatar wilsonge wilsonge - change - 12 Sep 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-09-12 20:32:53
Closed_By wilsonge
avatar wilsonge wilsonge - change - 17 Sep 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment