IniWriter: Delete nested properties

fixes #5958
This commit is contained in:
Marius Hein 2014-05-02 09:26:17 +02:00
parent c4e36ec467
commit 6aaff6b399
1 changed files with 3 additions and 2 deletions

View File

@ -130,13 +130,11 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
) {
// The current section. This value is null when processing the section-less root element
$section = empty($parents) ? null : $parents[0];
// Iterate over all properties in the new configuration file and search for changes
foreach ($newconfig as $key => $value) {
$oldvalue = $oldconfig->get($key);
$nextParents = array_merge($parents, array($key));
$keyIdentifier = empty($parents) ? array($key) : array_slice($nextParents, 1, null, true);
if ($value instanceof Zend_Config) {
// The value is a nested Zend_Config, handle it recursively
if ($section === null) {
@ -194,6 +192,9 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
// The deleted value is a plain value, use the editor to delete it
if (is_numeric($key)) {
$editor->resetArrayElement($keyIdentifier, $section);
} elseif (!empty($parents)) {
// Drop nested properties, fixes #5958
$editor->resetArrayElement($nextParents, $section);
} else {
$editor->reset($keyIdentifier, $section);
}