-
-
Notifications
You must be signed in to change notification settings - Fork 356
Using the three dots format to add items to an array gives an error #2718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did you try with parenthesis here ? ...(condition ? [include('something2.json.twig', {})] : []) Also i'm a bit surprised |
Thank you, but I tried with parenthesis and it gives the same error. |
Could you show the exact code in question, for us to try to help ? |
What is the error? |
Ok, this real code does not work:
The error line reads: |
Then it's more an issue from Twig? What version of Twig do you use ? |
The error is on v3.21.x but the code works on v3.20.x. |
Just tested, this exact code works on 3.21 {% set something = [
...(true ? ['a'] : ['b'])
]
%}
{{ something|json_encode }} Without parenthesis, it does produce the following error
|
Deciding if it's a bug will not something we can do here. So i'm closing here and let you continue the discussion on the twig topic indeed. |
Since v3.21.x, clearing the cache of a Symfony project fails if twig files use the "three dots" format to add circumstantial elements to an array.
The following code works on v3.20.x instead:
The text was updated successfully, but these errors were encountered: