8000 elseif with two spaces triggers exception · Issue #688 · twigjs/twig.js · GitHub
[go: up one dir, main page]

Skip to content

elseif with two spaces triggers exception #688

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

Closed
dfinton opened this issue Dec 10, 2019 · 1 comment · Fixed by #870
Closed

elseif with two spaces triggers exception #688

dfinton opened this issue Dec 10, 2019 · 1 comment · Fixed by #870

Comments

@dfinton
Copy link
dfinton commented Dec 10, 2019

The following code triggers a parse error in twig.js (this compiles successfully in its PHP counterpart). Note I've only tested this for the elseif tag. It could affect other tags as well. Removing the extra space after elseif fixes the parse error.

Hi there
{% if true %}
Yup
{% else %}
{% if 1 > 2 %}
This should not print
{% elseif  5 > 2 %}
  This should print
{% endif %}
{% endif %}

Expected behavior: code compiles successfully despite the extra space after elseif
Actual behavior: code returns the following error:

TwigException: Unable to parse 'elseif  5 > 2'

Node version 12.13.1
Twig version 1.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0