ENHANCEMENT Using eval() in textcollector to test for valid PHP syntax

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65054 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-01 19:05:16 +00:00
parent cc9cf5be06
commit 4e567adec9

View File

@ -311,14 +311,15 @@ class i18nTextCollector extends Object {
}
// Open the English file and write the Master String Table
if($fh = fopen($langFolder . '/' . $this->defaultLocale . '.php', "w")) {
$langFile = $langFolder . '/' . $this->defaultLocale . '.php';
if($fh = fopen($langFile, "w")) {
if($entities) foreach($entities as $fullName => $spec) {
$php .= $this->langArrayCodeForEntitySpec($fullName, $spec);
}
// test for valid PHP syntax by eval'ing it
try{
//eval($php);
eval($php);
} catch(Exception $e) {
user_error('i18nTextCollector->writeMasterStringFile(): Invalid PHP language file. Error: ' . $e->toString(), E_USER_ERROR);
}