We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

volt scope weirdness

OK so in a controller I have this:

$this->view->variable_a = <something>;

then in the volt:

{% for variable_a in some_array %}
    <do something>
{% endfor %}

OK so now variable_a from the for loop should be out of scope and if I reference variable_a farther down below that for loop variable _a should be back to the value it had in the controller. But instead it's the last value from the for loop! Is that expected behavior?

edited Mar '16

This is standard behavior of PHP, try to write code which you use directly in PHP, you will get the same result as you described. Volt compiles templates to native PHP so it is not a Volt problem.