cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

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

Open ToNict opened this issue 3 years ago • 2 comments

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

  • Phalcon version: v5.0.0beta3
  • PHP Version: php:8.0-fpm-alpine
  • Operating System: Windows 10
  • Installation type: Docker
  • Server: Nginx

ToNict avatar Feb 23 '22 09:02 ToNict

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

kowach avatar Feb 27 '22 10:02 kowach

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 avatar Feb 28 '22 18:02 niden

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

niden avatar Oct 12 '22 20:10 niden