1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/14285] Fix tests

PHPBB3-14285
This commit is contained in:
rubencm
2021-03-21 20:02:45 +01:00
parent 925502a92f
commit f66c1d9e1e
5 changed files with 21 additions and 261 deletions

View File

@@ -901,7 +901,8 @@ function parse_cfg_file($filename, $lines = false)
foreach ($lines as $line) {
$line = trim($line);
if (!$line || $line[0] == '#' || ($delim_pos = strpos($line, '=')) === false) {
if (!$line || $line[0] == '#' || ($delim_pos = strpos($line, '=')) === false)
{
continue;
}
@@ -909,15 +910,24 @@ function parse_cfg_file($filename, $lines = false)
$key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos))), ENT_COMPAT);
$value = trim(substr($line, $delim_pos + 1));
if (in_array($value, array('off', 'false', '0'))) {
if (in_array($value, array('off', 'false', '0')))
{
$value = false;
} else if (in_array($value, array('on', 'true', '1'))) {
}
else if (in_array($value, array('on', 'true', '1')))
{
$value = true;
} else if (!trim($value)) {
}
else if (!trim($value))
{
$value = '';
} else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"')) {
}
else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"'))
{
$value = htmlspecialchars(substr($value, 1, strlen($value) - 2), ENT_COMPAT);
} else {
}
else
{
$value = htmlspecialchars($value, ENT_COMPAT);
}