Fixed config-editor.php bug

Who the hell thought that eval+@ is a good alternative to try catch block?
This commit is contained in:
Mystia-Izakaya 2025-09-07 01:19:14 +03:00 committed by GitHub
parent 49276440e0
commit d3e8eb7480
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,7 +103,13 @@ function config_vars() {
continue; // This is just an alias.
if (!preg_match('/^array|\[\]|function/', $var['default']) && !preg_match('/^Example: /', trim(implode(' ', $var['comment'])))) {
$syntax_error = true;
$temp = eval('$syntax_error = false;return @' . $var['default'] . ';');
try {
$temp = $var['default'];
$syntax_error = false;
}
catch (Exception $e) {
$temp = false;
}
if ($syntax_error && $temp === false) {
error('Error parsing config.php (line ' . $line_no . ')!', null, $var);
} elseif (!isset($temp)) {