• Home
  • Get help
  • Ask a question
Last post 13 hours 58 min ago
Posts last week 81
Average response time last week 4 hours 29 min
All time posts 67914
All time tickets 10497
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#869 – double call for _fixUriLanguageVar in /administrator/components/com_sh404sef/classes/router.php file problem

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 18 August 2015 12:02 UTC
redcomponent
 Hi,

I have noticed you have double call for function_fixUriLanguageVar problem in /administrator/components/com_sh404sef/classes/router.php file

This results in removing lang var altogether.

This is the current code:
if (!$isValid && strpos($languageCode, '-') !== false)
{
$fixedLang = explode('-', $languageCode);
$fixedLang = empty($fixedLang) ? '' : $fixedLang[0];
if (!empty($fixedLang))
{
$uri->setVar('lang', $fixedLang);
}
}
else
{
// destroy invalid language
$uri->delVar('lang');
}

So when you have a valid $languageCode as set in $isValid, you will then delete that var. This is not correct.

I propose solution like this:
if (!$isValid && strpos($languageCode, '-') !== false)
{
$fixedLang = explode('-', $languageCode);
$fixedLang = empty($fixedLang) ? '' : $fixedLang[0];
if (!empty($fixedLang))
{
$uri->setVar('lang', $fixedLang);
}
}
elseif(!$isValid)
{
// destroy invalid language
$uri->delVar('lang');
}

So difference is only in else => elseif(!$isValid) which will ensure that valid language code is not removed
Thursday, 20 August 2015 07:16 UTC
wb_weeblr
Hi

Thanks for the head up, I can see that.

Can I ask how you noticed, and what effect it was having on the site you were using it on?

Thanks and regards

Yannick
 
Thursday, 20 August 2015 19:16 UTC
redcomponent
well I have custom switch language module, and it break up my links on the flags when I turn on sh404SEF :) So I dug up why it is so.

Thank you.
Monday, 24 August 2015 07:00 UTC
wb_weeblr
Thanks a lot for this. We'll do more testing with regular multilanguage sites (ie not custom language switchers), but this will be in next version.

Thanks again

Yannick
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.