mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
cc9cf5be06
commit
4e567adec9
@ -311,14 +311,15 @@ class i18nTextCollector extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open the English file and write the Master String Table
|
// 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) {
|
if($entities) foreach($entities as $fullName => $spec) {
|
||||||
$php .= $this->langArrayCodeForEntitySpec($fullName, $spec);
|
$php .= $this->langArrayCodeForEntitySpec($fullName, $spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for valid PHP syntax by eval'ing it
|
// test for valid PHP syntax by eval'ing it
|
||||||
try{
|
try{
|
||||||
//eval($php);
|
eval($php);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
user_error('i18nTextCollector->writeMasterStringFile(): Invalid PHP language file. Error: ' . $e->toString(), E_USER_ERROR);
|
user_error('i18nTextCollector->writeMasterStringFile(): Invalid PHP language file. Error: ' . $e->toString(), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user