phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.77k stars 1.97k forks source link

[BUG]: Volt Template Engine doesn't support this syntax [for loops] #15913

Closed ToNict closed 1 year ago

ToNict commented 2 years ago

Describe the bug Volt Template Engine doesn't support this syntax [for loops] NGINX will return a 502 Bad Gateway

  {% for key, group in session.loginUserGroupData %}
       {{ group['UserGroupName'] }}
  {% endfor %}

Details

kowach commented 2 years ago

If you are referencing to service object "session", I think you should call it from "this." this.session.loginUserGroupData

niden commented 2 years ago

If session is an object you have in your controller AND you have a service in the DI container for your session called session these two will clash.

First - if session is an object other than the Phalcon\Session\Manager - rename it to something else when you do the setVars() for your view. Then you can call it directly there. Also if loginUserGroupData is a method, it will need the parentheses loginUserGroupData()

niden commented 1 year ago

Closing this. If the issue persists please open a new one with relevant information