mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- bugfix for $smarty->config_overwrite = false
This commit is contained in:
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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');
|
||||
|
Reference in New Issue
Block a user