Skip to content

Commit

Permalink
Merge pull request #4445 from WoltLab/template-sandbox-foreachvars
Browse files Browse the repository at this point in the history
Sandbox `foreachVars` in templates
  • Loading branch information
dtdesign authored Aug 9, 2021
2 parents 87107e0 + 939a258 commit e738b4a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ public function getPluginClassName($type, $tag)
public function enableSandbox()
{
$index = \count($this->sandboxVars);
$this->sandboxVars[$index] = $this->v;
$this->sandboxVars[$index] = [
'foreachVars' => $this->foreachVars,
'v' => $this->v,
];
}

/**
Expand All @@ -555,7 +558,9 @@ public function disableSandbox()
throw new SystemException('TemplateEngine is currently not running in a sandbox.');
}

$this->v = \array_pop($this->sandboxVars);
$values = \array_pop($this->sandboxVars);
$this->foreachVars = $values['foreachVars'];
$this->v = $values['v'];
}

/**
Expand Down

0 comments on commit e738b4a

Please sign in to comment.