While reviewing the code this week, I realised that 2.5 and all earlier versions of ML have an unreported bug which could cause incorrect links in cached pages (when Drupal's page caching is switched on.) It would be fairly difficult to trigger (and notice) this bug in practice, which is possibly why nobody has reported it. It not easy to understand or document! Here it is....

Conditions:

* User is anonymous (not logged-in.)
* User visits a page, e.g. en/node/123 which is not already cached (the page cache was cleared, or this is the first anonymous visit to a new node.)
* Visitor's browser language preference setting is different from the language specified in the path, e.g. user goes to en/node/123 but browser language is set to fr. (This would not normally happen, they would usually visit example.com/fr/node/123 or fr/node/124 where 124 is the French version of 123.) In version 2.5, the same could happen irrespective of browser setting if they had previously used a Language Switcher to switch to fr, and later visited en/node/123, because ML 2.5 regards a deliberate language switch as setting a new "preferred" language.

Result:

Links generated by ML would be generated using the wrong preferred language - fr in the above example. The page would be cached by Drupal, so subsequent visits to en/node/123 would show the cached page with embedded links pointing to the French versions rather than English version of nodes referenced in the content.

Solution:

Now coded and will be in the dev version and included soon in a 6.x-2.6 release (and in D7 version). Works by ignoring visitors preferred language from browser and using language specified in path (or subdomain), i.e. $language->language. Thus, cached pages will be consistent. This action is triggered only when (a) user is anonymous and (b) Drupal page caching is switched on.

The ML Redirector will still work for anonymous visitors, e.g. to redirect from en/node/123 to fr/node/124 when it detects that the visitors preferred language is French. Preferred language for anonymous visitors is comes from browser or from an earlier choice they made using a supported Language Switcher.

Comments

Andy Inman’s picture

Just to add, where I said "The ML Redirector will still work for anonymous visitors..." - in all versions prior to the new 2.6, redirection for anonymous visitors would only work when serving non-cached pages, i.e. with page-caching switched off or for a page which was not in the cache for some reason. 2.6 changes that, and redirection behavior is the same whether a page is cached or not.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.