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/twig@1.13.3/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 :|
The changes from #629 seem to throw unnecessary errors.
Following template should always run even if
lieisn't defined andstrict_variablesis enabled - just the output should change:The {{ baked_good }} is a{% if lie is defined and lie %} lie {% else %} reality {% endif %}!However, with
strict_variablesenabled it fails withTwigException: Variable "lie" does not exist.Running Example: https://jsfiddle.net/jsz9uy3h/6/
If you use https://cdn.jsdelivr.net/npm/twig@1.13.3/twig.min.js in above fiddle it works.
For the moment I can only think of introducing context awareness into the
parsefunction ofTwig.expression.type.variable. However this seems like a good way to clutter things :|