Fix parsing empty strings in config.lua (with comments)

(cherry picked from commit eed490507c83518812451e0ba50b23d5a2914ab0)
This commit is contained in:
slawkens 2021-02-13 22:56:53 +01:00
parent 3d73de13d8
commit e3f2abc06e

View File

@ -968,7 +968,7 @@ function load_config_lua($filename)
foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
$value = str_replace($tmp_key, $tmp_value, $value); $value = str_replace($tmp_key, $tmp_value, $value);
$ret = @eval("return $value;"); $ret = @eval("return $value;");
if((string) $ret == '') // = parser error if((string) $ret == '' && trim($value) !== '""') // = parser error
{ {
throw new RuntimeException('ERROR: Loading config.lua file. Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]'); throw new RuntimeException('ERROR: Loading config.lua file. Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]');
} }