← Back to team overview

mahara-contributors team mailing list archive

[Bug 1239451] Re: "Cannot redeclare plural_en_utf8()" errors

 

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.

-- 
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:
  Triaged

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