"Cannot redeclare plural_en_utf8()" errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Won't Fix
|
Low
|
Unassigned |
Bug Description
See https:/
Also https:/
Under some circumstances, users see the error message "Cannot redeclare plural_en_utf8()". This isn't limited just to the English language pack -- others have reported it for German, "Cannot redeclare plural_de_utf8()".
The error is referring to the "plural_xx_utf8()" method, which is defined inside of the "langconfig.php" lang file. But those who are reporting it only have one copy of the method present in their langconfig file, and indeed inside their entire Mahara installation.
All who have reported it were using Mahara 1.5, so it's possible it may have been fixed in later versions. There is no clear indication of how to replicate this problem.
Changed in mahara: | |
status: | Triaged → Incomplete |
One commenter noted that the problem resolved when they changed lib/mahara.php's get_string_ from_file( ) method so that on line 783 instead of "include ($langfile);" it calls "include_ once($langfile) ;". This would be generally consistent with the error -- if the file is getting included twice, then the function will attempt to be defined twice, throwing this exact error.
The only strange thing is that the include statement is inside an if() block that should prevent it from being executed twice. There's a static $strings variable, and it stores the results of including the language file, and it before loading the language file it checks to see if it is already holding contents for it. So it doesn't make sense that the include() is happening more than once, unless there's some code that can clear out that static $strings, or if its check for whether it has loaded the file before, is not working properly.