- bugfix for $smarty->config_overwrite = false

This commit is contained in:
Uwe.Tews
2009-11-24 20:33:40 +00:00
parent 4925a98949
commit 2bab2f147d
3 changed files with 16 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
11/24/2009
- bugfix for $smarty->config_overwrite = false
11/23/2009
- suppress warnings on unlink caused by race conditions
- correct line number on unknown tag error message

View File

@@ -228,18 +228,26 @@ class Smarty_Internal_Config {
$this->template->properties['file_dependency']['F' . abs(crc32($this->getConfigFilepath()))] = array($this->getConfigFilepath(), $this->getTimestamp());
} else {
$this->smarty->properties['file_dependency']['F' . abs(crc32($this->getConfigFilepath()))] = array($this->getConfigFilepath(), $this->getTimestamp());
}
}
$config_data = unserialize($this->getCompiledConfig());
// var_dump($config_data);
// copy global config vars
foreach ($config_data['vars'] as $variable => $value) {
$scope->config_vars[$variable] = $value;
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
$scope->config_vars[$variable] = $value;
} else {
$scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
}
}
// scan sections
foreach ($config_data['sections'] as $this_section => $dummy) {
if ($sections == null || in_array($this_section, (array)$sections)) {
foreach ($config_data['sections'][$this_section]['vars'] as $variable => $value) {
$scope->config_vars[$variable] = $value;
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
$scope->config_vars[$variable] = $value;
} else {
$scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
}
}
}
}

View File

@@ -856,14 +856,14 @@ static public $yy_action = array(
$value = false;
}
if ($this->current_section == null) {
if ($this->smarty->config_overwrite) {
if ($this->smarty->config_overwrite || !isset($this->compiler->config_data['vars'][$this->yystack[$this->yyidx + -3]->minor])) {
$this->compiler->config_data['vars'][$this->yystack[$this->yyidx + -3]->minor]=$value;
} else {
settype($this->compiler->config_data['vars'][$this->yystack[$this->yyidx + -3]->minor], 'array');
$this->compiler->config_data['vars'][$this->yystack[$this->yyidx + -3]->minor][]=$value;
}
} else {
if ($this->smarty->config_overwrite) {
if ($this->smarty->config_overwrite || !isset($this->compiler->config_data['sections'][$this->current_section]['vars'][$this->yystack[$this->yyidx + -3]->minor])) {
$this->compiler->config_data['sections'][$this->current_section]['vars'][$this->yystack[$this->yyidx + -3]->minor]=$value;
} else {
settype($this->compiler->config_data['sections'][$this->current_section]['vars'][$this->yystack[$this->yyidx + -3]->minor], 'array');