static $lang in mahara.php

Bug #787123 reported by Heinz Krettek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Richard Mansfield
1.4
Fix Released
Medium
Richard Mansfield

Bug Description

Hi,

please check if the line with static $lang around line 821 or 925 prevents that language packs are installable?

I noticed/read this problem in a few German installations.

Cheers Heinz

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Heinz,

Does that mean the sites that are having the problems have fixed it by removing the 'static' keyword?

Changed in mahara:
status: New → Incomplete
Revision history for this message
Heinz Krettek (heinz-krettek) wrote :

Hi Richard,
yep several users reported this at mahara.org forums and Nigel modified my code also.

Cheers
Heinz

Revision history for this message
Heinz Krettek (heinz-krettek) wrote :
Revision history for this message
François Marier (fmarier) wrote :

Sounds like we need to investigate this one properly. Removing static here is likely to have a performance impact.

Changed in mahara:
status: Incomplete → Triaged
Changed in mahara:
status: Triaged → Confirmed
importance: Undecided → Medium
assignee: nobody → Richard Mansfield (richard-mansfield)
milestone: none → 1.5.0
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Looks to me like this is due to get_string being called before the config is loaded up, which can happen if, for example, the site fails one of the sanity checks, and calls get_string to report an error.

If that's the problem, then to fix it without any impact on performance, we can just reset the current language after loading the config.

Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

If I'm right about what's causing it, a better workaround which doesn't involve modifying the code would be to add the site language setting into config.php:

$cfg->lang = 'de.utf8';

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/294
Committed: http://gitorious.org/mahara/mahara/commit/9ca6bb553673486287bba8000e18c7027b8ad13f
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 9ca6bb553673486287bba8000e18c7027b8ad13f
Author: Richard Mansfield <email address hidden>
Date: Wed Jun 8 09:56:57 2011 +1200

    Reset the site language immediately after config is loaded (bug #787123)

    Because the $lang variable is declared as static in current_language(), a
    call to get_string in the sanity checks can set the language for the
    entire request, even before the site language has been read in from the
    config table. This ensures the language is reset immediately after config
    has been read.

    Change-Id: Ic81dfaedd70de75d93a6d38dd89915eeabcccd6e
    Signed-off-by: Richard Mansfield <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
François Marier (fmarier) wrote :

Also see bug 800512 for a fixup.

Changed in mahara:
milestone: 1.5.0 → none
status: Fix Committed → Fix Released
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/443
Committed: http://gitorious.org/mahara/mahara/commit/29580e66c884088d9b24662c49bf6ce6a69c88d1
Submitter: Francois Marier (<email address hidden>)
Branch: 1.4_STABLE

commit 29580e66c884088d9b24662c49bf6ce6a69c88d1
Author: Richard Mansfield <email address hidden>
Date: Tue Jul 5 16:05:44 2011 +1200

    Fix overzealous caching of site language

    Bug #787123
    See also bug #800512

    Remove caching of default site language and session language
    (cherry picked from commits 966e804bb39e2151f00dbb4a7881994139fc7288
    and 9ca6bb553673486287bba8000e18c7027b8ad13f)

    Change-Id: Iae6d8c4a1de152a8cc3778cd47fc3cb4b81b5696
    Signed-off-by: Richard Mansfield <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.