mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
fixed macros when using an argument named like a PHP super globa
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.16.2 (2014-XX-XX)
|
||||
|
||||
* fixed macros when using an argument named like a PHP super global (like GET or POST)
|
||||
* fixed date_modify when working with DateTimeImmutable
|
||||
* optimized for loops
|
||||
* fixed multi-byte characters handling in the split filter
|
||||
|
||||
@@ -37,7 +37,7 @@ class Twig_Node_Macro extends Twig_Node
|
||||
$pos = 0;
|
||||
foreach ($this->getNode('arguments') as $name => $default) {
|
||||
$compiler
|
||||
->raw('$_'.$name.' = ')
|
||||
->raw('$__'.$name.'__ = ')
|
||||
->subcompile($default)
|
||||
;
|
||||
|
||||
@@ -64,7 +64,7 @@ class Twig_Node_Macro extends Twig_Node
|
||||
$compiler
|
||||
->write('')
|
||||
->string($name)
|
||||
->raw(' => $_'.$name)
|
||||
->raw(' => $__'.$name.'__')
|
||||
->raw(",\n")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase
|
||||
return array(
|
||||
array($node, <<<EOF
|
||||
// line 1
|
||||
public function getfoo(\$_foo = null, \$_bar = "Foo")
|
||||
public function getfoo(\$__foo__ = null, \$__bar__ = "Foo")
|
||||
{
|
||||
\$context = \$this->env->mergeGlobals(array(
|
||||
"foo" => \$_foo,
|
||||
"bar" => \$_bar,
|
||||
"foo" => \$__foo__,
|
||||
"bar" => \$__bar__,
|
||||
));
|
||||
|
||||
\$blocks = array();
|
||||
|
||||
Reference in New Issue
Block a user