Twig yields an escaped string and treats a missing variable as empty
The rule
Normative: this is the rule
- A Twig template MUST produce a string.
- The string MUST be HTML-escaped unless the value is piped through
raw. - A variable absent from the context MUST render as the empty string rather than failing.
- A template that cannot be compiled, and a template that fails while rendering, MUST both fail with an error saying which of the two occurred.
Why
Recorded under OPEN-25.
Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · LANG-7 · changed in spec 1.0