array_map Variable to Variable::getValue in getTemplateVars.

Fixes #994
This commit is contained in:
Simon Wisselink
2024-04-13 10:43:21 +02:00
parent 177a3f4e6e
commit d95c9b4850
2 changed files with 5 additions and 1 deletions

1
changelog/994.md Normal file
View File

@ -0,0 +1 @@
- Fix that getTemplateVars would return an array of objects instead of the assigned variables values [#994](https://github.com/smarty-php/smarty/issues/994)

View File

@ -224,7 +224,10 @@ class Data
return $this->getValue($varName, $searchParents); return $this->getValue($varName, $searchParents);
} }
return array_merge($this->parent && $searchParents ? $this->parent->getTemplateVars() : [], $this->tpl_vars); return array_merge(
$this->parent && $searchParents ? $this->parent->getTemplateVars() : [],
array_map(function(Variable $var) { return $var->getValue(); }, $this->tpl_vars)
);
} }
/** /**