fabpot/Twig — Issue #608: attribute function arguments issue
Author: vkartaviy
Created: 2012-01-23 04:27:02+00:00
State: open

When i trying to render below template i got unexpected result:

---------------------------------------------------------------------------------------

Template source:

{% macro foo(a, b) %}
{{ attribute(_self, "bar", [a, b]) }}
{% endmacro %}

{% macro bar(a, b) %}
a = {{ a }}, b = {{ b }}
{% endmacro %}

{{ _self.foo("a", "b") }}

--------------------------------------------------------------------------------------

Expected: a = a, b = b
Actual: a = 0, b = a

--------------------------------------------------------------------------------------

Compiled template method:

public function getfoo($a = null, $b = null)
{
....
echo twig_escape_filter($this->env, $this->getAttribute($this, "bar", array(0, $_a_, 1, $_b_, )), "html", null, true);
....
}