From 3e0c5e06b12f4e5ec6d2a488a1d2a42f6d5c0ab8 Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Tue, 8 Mar 2011 16:14:38 +0000 Subject: [PATCH] fixed config_load to only load defaults with no section defined --- change_log.txt | 2 ++ libs/sysplugins/smarty_internal_config.php | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/change_log.txt b/change_log.txt index 019811a8..a46a9d3a 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,6 @@ ===== SVN trunk ===== +08/03/2011 +- bugfix loading config file without section should load only defaults 03/03/2011 - bugfix "smarty" template variable was not recreated when cached templated had expired - bugfix internal rendered_content must be cleared after subtemplate was included diff --git a/libs/sysplugins/smarty_internal_config.php b/libs/sysplugins/smarty_internal_config.php index 06ae70ba..53555123 100644 --- a/libs/sysplugins/smarty_internal_config.php +++ b/libs/sysplugins/smarty_internal_config.php @@ -272,16 +272,18 @@ class Smarty_Internal_Config { } } // scan sections - foreach ($_config_vars['sections'] as $this_section => $dummy) { - if ($sections == null || in_array($this_section, (array)$sections)) { - foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) { - if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { - $scope_ptr->config_vars[$variable] = $value; - } else { - $scope_ptr->config_vars[$variable] = array_merge((array)$scope_ptr->config_vars[$variable], (array)$value); - } - } - } + if(!empty($sections)) { + foreach ($_config_vars['sections'] as $this_section => $dummy) { + if (in_array($this_section, (array)$sections)) { + foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) { + if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { + $scope_ptr->config_vars[$variable] = $value; + } else { + $scope_ptr->config_vars[$variable] = array_merge((array)$scope_ptr->config_vars[$variable], (array)$value); + } + } + } + } } } }