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:
Fabien Potencier
2024-10-24 17:55:22 +02:00
+1 -1
View File
@@ -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'));