Fixed bug in {include} variable assignment and removed some unused/unrequired code

This commit is contained in:
Simon Wisselink
2023-01-23 16:40:27 +01:00
parent 34a0a2876b
commit ecac24d073
4 changed files with 5 additions and 21 deletions

View File

@@ -126,13 +126,13 @@ class Data
break;
case self::SCOPE_LOCAL:
default:
if ($this->hasVariable($tpl_var)) {
$this->getVariable($tpl_var)->setValue($value);
if (isset($this->tpl_vars[$tpl_var])) {
$this->tpl_vars[$tpl_var]->setValue($value);
if ($nocache) {
$this->getVariable($tpl_var)->setNocache(true);
$this->tpl_vars[$tpl_var]->setNocache(true);
}
} else {
$this->tpl_vars[ $tpl_var ] = new Variable($value, $nocache);
$this->tpl_vars[$tpl_var] = new Variable($value, $nocache);
}
}

View File

@@ -531,12 +531,6 @@ class Smarty extends \Smarty\TemplateBase
*/
private $BCPluginsAdapter;
/**
* Cache of templates created
* @var array
*/
private $templates;
/**
* Initialize new Smarty object
*/
@@ -1000,12 +994,6 @@ class Smarty extends \Smarty\TemplateBase
}
$_templateId = $this->generateUniqueTemplateId($template_name, $cache_id, $compile_id, $caching, $baseFilePath);
// if (true || !isset($this->templates[$_templateId])) {
// $this->templates[$_templateId] = new Template($template_name, $this, null, $cache_id, $compile_id, $caching);
// $this->templates[$_templateId]->templateId = $_templateId;
// }
// $tpl = $this->templates[$_templateId];
$tpl = new Template($template_name, $this, $parent ?: $this, $cache_id, $compile_id, $caching);
$tpl->templateId = $_templateId;

View File

@@ -268,10 +268,6 @@ class Template extends TemplateBase {
$tpl->setDefaultScope($scope);
}
// copy variables
$tpl->tpl_vars = $this->tpl_vars;
$tpl->config_vars = $this->config_vars;
// recursive call ?
if ($tpl->getTemplateId() !== $this->getTemplateId()) {

View File

@@ -120,7 +120,7 @@ class CompileWhileTest extends PHPUnit_Smarty
}
/*
* Data provider für testNocache
* Data provider for testNocache
*/
public function dataTestNocache()
{