mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
bug #4413 do not drop none digit characters from generated variable names (xabbuh)
This PR was merged into the 3.x branch.
Discussion
----------
do not drop none digit characters from generated variable names
I was wondering if it was really intended to cast the var name generated by the compiler to an int as done in #4398. Doesn't this create the risk of variable names being reused at some point?
Commits
-------
5b0209ffa3 do not drop none digit characters from generated variable names
This commit is contained in:
@@ -41,7 +41,7 @@ class TempNameExpression extends AbstractExpression
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
if (null === $this->getAttribute('name')) {
|
||||
$this->setAttribute('name', \sprintf('_l%d', $compiler->getVarName()));
|
||||
$this->setAttribute('name', $compiler->getVarName());
|
||||
}
|
||||
|
||||
$compiler->raw('$'.$this->getAttribute('name'));
|
||||
|
||||
Reference in New Issue
Block a user