MyBB Community Forums

Full Version: [F] config_spiders.lang.php overrides $lang->language [C-sayakb]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The file config_spiders.lang.php contains this entry:

config_spiders.lang.php:$l['language'] = "Language";

This overrides the $lang->language value which is used by $lang->load() to determine the folder in which to look for language files:

    function load($section, $isdatahandler=false, $supress_error=false)
        // Assign language variables.
        // Datahandlers are never in admin lang directory.
        if($isdatahandler === true)
            $this->language = str_replace('/admin', '', $this->language);
        $lfile = $this->path."/".$this->language."/".$section.".lang.php";

So it seems because $lang internal variables like current language, path, etc. as well as the language strings themselves are stored in the same object, it must be ensured that these do not collide, i.e. there mustn't be an $l['path'] or $l['language'] (and probably others, haven't read all of the code) in any of the language files.

This doesn't cause errors in normal operation because the config_spiders.lang.php happens to be the last language file being loaded during a request. However if a plugin tries to load another language file after that, it will fail with file not found errors, because $lang tries to load inc/languages/Language/..., Language being the value of $l['language'] of config_spiders.lang.php.

I'll avoid this problem by moving my $lang->load() statements to more specific hooks in my plugin.
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group