?
avatar frogydiak
frogydiak
9 May 2016

Steps to reproduce the issue

Create a page with menu item and set to show a module for that page. Everything looks great until you change the URL from:

index.php?option=com_content&id=1&Itemid=101

to

index.php?option=com_content&id=1&Itemid=101

That happens when I programmatically redirect pages to a URL using JRoute::() method to create the URL without adding false as the second parameter to the JRoute::() method.

Expected result

Module will still appear in the page.

Actual result

Page still renders but the module will disappear. The method:

$this->countModules($position)

returns null.

System information (as much as possible)

Joomla v3.5.1
Setting Value

PHP Built On

Linux 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64

Database Version

5.5.47-MariaDB

Database Collation

utf8_general_ci

Database Connection Collation

utf8mb4_general_ci

PHP Version
5.4.16

Web Server

nginx/1.10.0

WebServer to PHP Interface

fpm-fcgi

Joomla! Version
Joomla! 3.5.1 Stable [ Unicorn ] 05-April-2016 22:45 GMT

Joomla! Platform Version

Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

User Agent

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

Additional comments

At first I was thinking maybe changing & to & is mandatory for xml view but html is default and why would JRoute::_() defaults to xhtml. Can any of the Joomla masters educate a fledgling please. Thanks!

avatar frogydiak frogydiak - open - 9 May 2016
avatar frogydiak frogydiak - change - 9 May 2016
The description was changed
avatar frogydiak frogydiak - change - 9 May 2016
The description was changed
avatar photodude
photodude - comment - 10 May 2016

Your fromURL and toURL are exactly the same... Can you clarify?

avatar zero-24
zero-24 - comment - 10 May 2016

i think this is expected behavioir see:

https://api.joomla.org/cms-3/classes/JRoute.html

Translates an internal Joomla URL to a humanly readable URL.

_(string $url, boolean $xhtml = true, integer $ssl = null) : string
$xhtml
boolean Replace & by & for XML compliance.

The second parameter default value is true so you need to set it to false if you want it.

@photodude it is & and &

avatar zero-24 zero-24 - change - 10 May 2016
Category Libraries Router / SEF
avatar brianteeman brianteeman - close - 10 May 2016
avatar brianteeman brianteeman - change - 10 May 2016
Status New Expected Behaviour
Closed_Date 0000-00-00 00:00:00 2016-05-10 08:17:30
Closed_By brianteeman
avatar brianteeman brianteeman - close - 10 May 2016
avatar Bakual Bakual - close - 10 May 2016
avatar brianteeman brianteeman - close - 10 May 2016
avatar brianteeman
brianteeman - comment - 10 May 2016

Closed as expected behaviour


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

avatar Bakual Bakual - change - 10 May 2016
The description was changed
avatar frogydiak
frogydiak - comment - 10 May 2016

Hi brianteeman,

My point is why is if xhtml=true is for XML compliance then why set it to true by default when the default view is html format? Why not set the xhtml automatically depending on a view format requested?

Having to add the second parameter (false) when redirecting to view.html.php using JRoute is an extra step, don't you think?

And by the way, if I am redirecting to a page from a controller, because of that behaviour my modules will disappear after redirect renders unless I explicitly add the second parameter false in JRoute. But it does render fine if SEF is enabled.

avatar mbabker
mbabker - comment - 10 May 2016

Joomla's layouts for the longest time defaulted to aiming for XHTML compliance and as such that's how the system is designed.

avatar frogydiak
frogydiak - comment - 10 May 2016

Hi mbabker,
I see, then why the modules disappears when the URL is XHTML compliant? Is it also by design?

avatar mbabker
mbabker - comment - 10 May 2016

Probably has something to do with the decoding of the ampersand when used in a URL that way and causes values to not be set to PHP's superglobals correctly. Either way it has nothing to do with JRoute at that point.

avatar frogydiak
frogydiak - comment - 10 May 2016

Probably it's not the JRoute I agree. But that I believe is an issue, just noticed that the modules that are set to show in a specific Item id are those module that only disappears but not those modules that are set to show in all pages.

avatar mbabker
mbabker - comment - 10 May 2016

If it's not being decoded into PHP correctly that's the issue. With option=com_content&id=1&Itemid=101 without proper decoding you'd have something equivalent to $_GET['id'] = '1&Itemid=101' and no $_GET['Itemid'] value, and that's happening outside Joomla.

avatar frogydiak
frogydiak - comment - 10 May 2016

The problem is my URL is being processed inside Joomla and just redirecting. I'm not even using $_GET variable. To be specific, I am using:

$app->redirect( JRoute::_('index.php?option=com_content&id=1&Itemid=' . $itemid) );

And I tried this in 2 different servers: 1 - XAMPP 7.0.4 in Mac, 2 - CentOS server with LEMP and Joomla is having the same behaviour. Must be in countModules() method or somewhere. You can try it in your site if you want and I hope you'll find it strange for a module to disappear. But make sure SEF is turned off.

I'm just reporting this strange behaviour and have no solution to offer, but hoping you guys find it strange and hope I'll get an answer as to why. Anyways, thanks for you answers.

avatar brianteeman brianteeman - change - 13 May 2016
Labels Added: ?
avatar theret
theret - comment - 8 Aug 2016

Hey
I am having the same issue with a plugin using : $app->redirect( JRoute::_('index.php?option=com_content&id=1&Itemid=' . $itemid) );

The output redirects with &amp instead of & : http://cdl.joomlademos.co.uk/index.php?option=com_content&view=featured&Itemid=1207

Ideas?

Thanks


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

avatar theret
theret - comment - 8 Aug 2016

Sorry I am using : if($itemid) $app->redirect(JRoute::_($menuitem->link.'&Itemid='.$itemid));

Joomla 3.6.3
Database Version 5.6.30-log
Database Collation utf8_unicode_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.24


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

avatar brianteeman
brianteeman - comment - 8 Aug 2016

No one will see a comment on a closed issue

avatar theret
theret - comment - 8 Aug 2016

Oh sorry... first time using this issue tracker... will open new one. Thanks


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

Add a Comment

Login with GitHub to post a comment