From f9e7e6d88816aa58456f53581c01081b3f268382 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 16 Oct 2014 11:20:16 +0200 Subject: [PATCH] general config: Don't keep unused configuration directives --- application/forms/Config/GeneralConfigForm.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php index 550fe4cfb..0b55704c2 100644 --- a/application/forms/Config/GeneralConfigForm.php +++ b/application/forms/Config/GeneralConfigForm.php @@ -40,13 +40,16 @@ class GeneralConfigForm extends ConfigForm */ public function onSuccess(Request $request) { + $sections = array(); foreach ($this->getValues() as $sectionAndPropertyName => $value) { list($section, $property) = explode('_', $sectionAndPropertyName); - if (isset($this->config->{$section})) { - $this->config->{$section}->{$property} = $value; - } else { - $this->config->{$section} = array($property => $value); + if (! isset($sections[$section])) { + $sections[$section] = array(); } + $sections[$section][$property] = $value; + } + foreach ($sections as $section => $config) { + $this->config->{$section} = $config; } if ($this->save()) {