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

Bug If, Elseif, Else in Volt

Today i was working in my sistem when i get a error, but the code seems has no errors

The error happens when i put a for inside another in an conditional if, elseif, else Something like this:

{% if condition is defined %}
    {% for a in app %}
        {% for ac in a.getAppCategory() %}
        {% endfor %}
    {% endfor %}
{% elseif other_condition is defined %}
    //codes
{% else %}
    //codes
{% endif %}

Then this show a error appointed to the else line.

Unexpected ENDIF

If i remove the second for the error disappears.

I have searched for this error here in the forum and i found this very similar

https://forum.phalcon.io/discussion/2607/nested-for-combined-with-if-throws-exceptions

Is this a bug right? Or me and this guy are doing something wrong?

Yes this is a bug and has been issued under https://github.com/phalcon/cphalcon/issues/10970