Skip to content

Commit

Permalink
Deep cloning of template definition (#2799)
Browse files Browse the repository at this point in the history
* Deep cloning of template definition
  • Loading branch information
roadster31 committed Nov 26, 2020
1 parent 021afd2 commit f2e828f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion local/modules/TheliaSmarty/Template/SmartyParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ public function setTemplateDefinition(TemplateDefinition $templateDefinition, $f
*/
public function getTemplateDefinition($webAssetTemplateName = false)
{
$ret = clone $this->templateDefinition;
// Deep clone of template definition. We could change the template descriptor of template definition,
// and we don't want to change the current template definition.

/** @var TemplateDefinition $ret */
$ret = unserialize(serialize($this->templateDefinition));

if (false !== $webAssetTemplateName) {
$customPath = str_replace($ret->getName(), $webAssetTemplateName, $ret->getPath());
Expand Down

0 comments on commit f2e828f

Please sign in to comment.