cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Volt issue- array keys must be always a string...

Open borisdelev opened this issue 10 years ago • 3 comments

Hi there :)

Today i find something wrong with volt (or i think is wrong), so let u show u by example (in volt template):

{% set weekdays = [1: 'Monday', 2: 'Tuesday'] %}

This example will NOT work- return error: "Phalcon\Mvc\View\Exception: Syntax error, unexpected token COLON".

I notice smnth- this example will work only when the keys are strings, like: ['1': 'Monday', '2' ...]. Is it normal that behavior?

phpinfo : Phalcon version is : 2.1.0r on PHP 5.6.3 (windows build)

Thank u :) Have a nice week!

borisdelev avatar Jun 12 '16 21:06 borisdelev

@butamuh4o Could you please provide script to reproduce (use case)?

sergeyklay avatar Jun 14 '16 00:06 sergeyklay

Hi @sergeyklay and thanks for respond :)

Well... i am not sure what u mean by that (because that is all script u need, or i dont understand (sorrry)), but... just add in some of your volt templates this line:

{% set weekdays = [1: 'Monday', 2: 'Tuesday'] %} - and u will notice respond of error. But if u modify keys and put them in quotes (like {% set weekdays = ['1': 'Monday', '2': 'Tuesday'] %}) - will work.

Thats all :/ if it is need, i will do more to describe the issue, but for now i cant understand what (sorry about it).

borisdelev avatar Jun 14 '16 09:06 borisdelev

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

stale[bot] avatar Apr 16 '18 16:04 stale[bot]