Skip to content

Should "is defined" check resolve to false if the variable is explicitly undefined?

If I pass { foo: undefined} to a Twing template as context, the conditional {% if foo is defined %} resolves to true. I think it would be better if it resolved to false instead.

Of course, PHP doesn't have undefined, so there's no direct parallel to TwigPHP here. But I do occasionally run into hard-to-diagnose bugs because of this; I can go into more detail if desired.

(This is related to #553.)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information