The session language switcher allows to switch the site's language based on a request/session parameter. The session parameter should be initialized only for anonymous users, otherwise pages cannot be cached as an empty session is a necessary condition to do that.

Comments

plach’s picture

Status: Active » Needs review
StatusFileSize
new887 bytes

The attached patch should fix the issue.

plach’s picture

Issue tags: +Quick fix
catch’s picture

Status: Needs review » Active
Issue tags: -Quick fix

subscribing.

plach’s picture

Status: Active » Needs review
Issue tags: +Quick fix
plach’s picture

plach’s picture

This is a major issue.

damien tournoud’s picture

-  // Request parameter.
+  // Request parameter: we need to update the session parameter only if we have
+  // an authenticated user.
   if (isset($_GET[$param]) && isset($languages[$langcode = $_GET[$param]])) {
-    return $_SESSION[$param] = $langcode;
+    global $user;
+    return $user->uid ? ($_SESSION[$param] = $langcode) : $langcode;
   }

Two inline assignments, that's at least two too many.

Otherwise, the fix is ok. And just proves that the session language switcher is really a bad idea.

plach’s picture

And just proves that the session language switcher is really a bad idea.

There should be no problems to remove it from core then.

plach’s picture

StatusFileSize
new932 bytes

Fixed #7.

plach’s picture

StatusFileSize
new908 bytes

windows newlines

damien tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Let's get this in.

People need to understand that serving different content at the same URL is just a bad idea. But that's out of the scope of this issue :)

plach’s picture

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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

mustanggb’s picture

Priority: Normal » Major