Fix issue that caused IniWriter to fail on empty configs

This commit is contained in:
Matthias Jentsch 2015-08-06 17:21:52 +02:00
parent 2a1f0132bc
commit 9b373e9d10
3 changed files with 5 additions and 3 deletions

View File

@ -67,6 +67,7 @@ class Document
*/ */
public function render() public function render()
{ {
$sections = array();
foreach ($this->sections as $section) { foreach ($this->sections as $section) {
$sections []= $section->render(); $sections []= $section->render();
} }

View File

@ -7,7 +7,7 @@ class Section
{ {
/** /**
* @var string * @var string
* */
protected $name; protected $name;
/** /**

View File

@ -178,8 +178,9 @@ class IniWriter
Logger::warning('Section-less property ' . (string)$directives . ' was ignored.'); Logger::warning('Section-less property ' . (string)$directives . ' was ignored.');
continue; continue;
} }
if ($newconfig->hasSection($section)) {
$newSection = $newconfig->getSection($section); $newSection = $newconfig->getSection($section);
if (isset($newSection)) {
$oldDomSection = $doc->getSection($section); $oldDomSection = $doc->getSection($section);
foreach ($directives as $key => $value) { foreach ($directives as $key => $value) {
if ($value instanceof ConfigObject) { if ($value instanceof ConfigObject) {