? Success

User tests: Successful: Unsuccessful:

avatar smanzi
smanzi
10 Oct 2014

#4221 was incorrectly using str_replace() to remove the default language code when required. As str_replace() acts globally on the subject, the language code was removed also out of context (e.g. when part of an alias).

With this PR I use instead preg_replace() with the limit of one substitution. As the /language-code/ string to be replaced appears between two slashes and just after the host name (eg. http://example.com/en/) this should guarantee the correct replacements of the language code only.

I took the occasion to make a bit of clean-up by aggregating some redundantly duplicated code

avatar smanzi smanzi - open - 10 Oct 2014
avatar jissues-bot jissues-bot - change - 10 Oct 2014
Labels Added: ?
avatar infograf768
infograf768 - comment - 10 Oct 2014

@test
Fine here.

avatar smanzi
smanzi - comment - 10 Oct 2014

@test
Good here too, on a production server
Does my word count?

avatar smanzi
smanzi - comment - 10 Oct 2014

@infograf768

I just noticed my local copy of languagefilter.php is CR-LF terminated (à-la-windows...)

Is this a problem? Can be fixed?

avatar infograf768
infograf768 - comment - 10 Oct 2014

It is Unix in core

avatar infograf768 infograf768 - close - 10 Oct 2014
avatar infograf768 infograf768 - change - 10 Oct 2014
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-10 17:04:24
avatar infograf768
infograf768 - comment - 10 Oct 2014

Thanks for the fix. Merged.
please test #4425 for 2.5.x

avatar smanzi
smanzi - comment - 10 Oct 2014

You're welcome!
Tested #4425 with success.

Add a Comment

Login with GitHub to post a comment