Skip to content

Regression: Enabled strict_variables throw unnecessary errors  #679

Open
@das-peter

Description

@das-peter

The changes from #629 seem to throw unnecessary errors.
Following template should always run even if lie isn't defined and strict_variables is enabled - just the output should change:
The {{ baked_good }} is a{% if lie is defined and lie %} lie {% else %} reality {% endif %}!

However, with strict_variables enabled it fails with TwigException: Variable "lie" does not exist.
Running Example: https://jsfiddle.net/jsz9uy3h/6/

If you use https://cdn.jsdelivr.net/npm/[email protected]/twig.min.js in above fiddle it works.

For the moment I can only think of introducing context awareness into the parse function of Twig.expression.type.variable. However this seems like a good way to clutter things :|

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions