-
Notifications
You must be signed in to change notification settings - Fork 275
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
Bug when using triple starting braces. #896
Comments
It's most likely interpreting it as a map, which is an object in JavaScript. What happens if you use that same template in Twig PHP? |
@willrowe, I just tested and TwigPHP throws a syntax error:
Using twing, which is more accurate than TwingPHP, we get a the same error, alongside the column where the parsing failed:
This is interesting because at column 46, there is the last closing "}". We would need to investigate the TwigPHP / Twing parsers to understand why this column is the one where the error is detected. |
Any update on this? |
@sanketdhoble if you would like to look into this and draft up a PR then we will take a look. This project is completely open source and core developers only work on it when they have extra time to do so. |
For the below invalid syntax with triple brackets:
"Hey {{{data.variables.aa | default('there') }}"
data = { variables: {} }
I get output as
[object][object]
instead of getting syntax error. Why twig didn't throw it as an invalid syntax?FYI: for input with starting & closing 3 braces :
"Hey {{{data.variables.aa | default('there') }}}"
I get output:"Hey [object][object]}"
Since I mistakenly added 3 braces, I expect to get an error instead of [object][object]
I used template.tokens to catch any twig syntax errors, but that didn't catch above error:
Any thoughts?
The text was updated successfully, but these errors were encountered: