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
Closed
@dfinton

Description

@dfinton

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0