diff --git a/CRM/Core/Config/MagicMerge.php b/CRM/Core/Config/MagicMerge.php index ffb7e6434708..801f803f3b4e 100644 --- a/CRM/Core/Config/MagicMerge.php +++ b/CRM/Core/Config/MagicMerge.php @@ -318,10 +318,6 @@ public function __set($k, $v) { unset($this->cache[$k]); $type = $this->map[$k][0]; - // If foreign name is set, use that name (except with callback types because - // their second parameter is the object, not the foreign name). - $name = isset($this->map[$k][1]) && $type != 'callback' ? $this->map[$k][1] : $k; - switch ($type) { case 'setting': case 'setting-path': @@ -331,12 +327,12 @@ public function __set($k, $v) { case 'callback': case 'boot-svc': // In the past, changes to $config were not persisted automatically. - $this->cache[$name] = $v; + $this->cache[$k] = $v; return; case 'local': $this->initLocals(); - $this->locals[$name] = $v; + $this->locals[$k] = $v; return; default: diff --git a/tests/phpunit/CRM/Core/Config/MagicMergeTest.php b/tests/phpunit/CRM/Core/Config/MagicMergeTest.php new file mode 100644 index 000000000000..250075df5bae --- /dev/null +++ b/tests/phpunit/CRM/Core/Config/MagicMergeTest.php @@ -0,0 +1,74 @@ +{$field}; + + $config->{$field} = $tempValue; + $this->assertEquals($tempValue, $config->{$field}); + + $config = CRM_Core_Config::singleton(); + $this->assertEquals($tempValue, $config->{$field}); + + $config = CRM_Core_Config::singleton(TRUE, TRUE); + $this->assertEquals($origValue, $config->{$field}); + } + +}