Config::fromIni(): use IniParser::parseIniFile() instead of parse_ini_file()

refs #10150
This commit is contained in:
Alexander A. Klimov 2015-09-22 14:46:15 +02:00
parent acb93ce1ae
commit 626c3494e4

View File

@ -12,6 +12,7 @@ use Icinga\Data\ConfigObject;
use Icinga\Data\Selectable; use Icinga\Data\Selectable;
use Icinga\Data\SimpleQuery; use Icinga\Data\SimpleQuery;
use Icinga\File\Ini\IniWriter; use Icinga\File\Ini\IniWriter;
use Icinga\File\Ini\IniParser;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
/** /**
@ -313,7 +314,7 @@ class Config implements Countable, Iterator, Selectable
if ($filepath === false) { if ($filepath === false) {
$emptyConfig->setConfigFile($file); $emptyConfig->setConfigFile($file);
} elseif (is_readable($filepath)) { } elseif (is_readable($filepath)) {
$config = new static(new ConfigObject(parse_ini_file($filepath, true))); $config = static::fromArray(IniParser::parseIniFile($filepath)->toArray());
$config->setConfigFile($filepath); $config->setConfigFile($filepath);
return $config; return $config;
} elseif (@file_exists($filepath)) { } elseif (@file_exists($filepath)) {