]> git.mjollnir.org Git - moodle.git/commitdiff
moodlelib: MDL-17761 More consistent error handling in get_string.
authortjhunt <tjhunt>
Fri, 16 Jan 2009 04:18:43 +0000 (04:18 +0000)
committertjhunt <tjhunt>
Fri, 16 Jan 2009 04:18:43 +0000 (04:18 +0000)
lib/moodlelib.php

index ac669dfd0150288125304218cce71729d8cc122c..35b071e06cf2e3733eb27d6a0e850dfdb7af27d4 100644 (file)
@@ -5463,14 +5463,18 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
         $langfile = $location.$lang.'/'.$filetocheck;
         if (file_exists($langfile)) {
             if ($result = get_string_from_file('parentlanguage', $langfile, "\$parentlang")) {
-                eval($result);
+                if (eval($result) === FALSE) {
+                    trigger_error('Lang error: '.$identifier.':'.$langfile, E_USER_NOTICE);
+                }
                 if (!empty($parentlang)) {   // found it!
 
                     //first, see if there's a local file for parent
                     $locallangfile = $location.$parentlang.'_local'.'/'.$module.'.php';
                     if (file_exists($locallangfile)) {
                         if ($result = get_string_from_file($identifier, $locallangfile, "\$resultstring")) {
-                            eval($result);
+                            if (eval($result) === FALSE) {
+                                trigger_error('Lang error: '.$identifier.':'.$locallangfile, E_USER_NOTICE);
+                            }
                             return $resultstring;
                         }
                     }