mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #15748
[Bug 1239451] Re: "Cannot redeclare plural_en_utf8()" errors
Someone reported this error in Mahara 1.7 as well:
https://mahara.org/interaction/forum/topic.php?id=5967&offset=0&limit=10#post25454
Perhaps we should implement the suggested fix of changing that include()
to an include_once(). Certainly, any file that contains functions
*should* be loaded with include_once, and since we put a function in
langconfig.php, that's the case. Though on the other hand, I'm puzzled
as to *how* this file is getting included more than once. Here's what
the function looks like:
function get_string_from_file($identifier, $langfile) {
static $strings; // Keep the strings cached in memory.
if (empty($strings[$langfile])) {
$string = array();
include ($langfile);
$strings[$langfile] = $string;
} else {
$string = &$strings[$langfile];
}
if (!isset ($string[$identifier])) {
return false;
}
return $string[$identifier];
}
The first time langconfig.php is loaded, it should be stored in the
static array $strings['langconfig.php'];. Then the next time the
function runs through, empty($strings[$langfile]) will return false, and
the include() will be skipped. Perhaps there's some quirk in the way
include() or static works, which I'm not understanding?
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1239451
Title:
"Cannot redeclare plural_en_utf8()" errors
Status in Mahara ePortfolio:
Incomplete
Bug description:
See
https://mahara.org/interaction/forum/topic.php?id=4665&offset=0&limit=10#post24779
Also https://bugs.launchpad.net/mahara-adminlang/+bug/1012580
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1239451/+subscriptions
References