Skip to content

Twig 2.9 assumes that the filter tag creates a new context scope #3091

@ericmorand

Description

@ericmorand

This is what the documentation says now:

As of Twig 2.9, you should use the apply tag instead which does the same thing except that the wrapped template data is not scoped.

This was not the case before Twig 2.9: neither the documentation nor the test suite did say anything about the fact that the filter tag creates a new context scope. The documentation and the test were added on April 2019 (this commit: 619bc12).

Prior to that, the filter tag was not supposed to create a new scope. But it did on TwigPHP prior to 2.9. Which means that TwigPHP filter tag implementation was faulty.

Then, with TwigPHP 2.9, instead of fixing the bug, you have updated the documentation and added a test! Which is a breaking change.

Let me summarize:

  • The specifications don't say anything about the fact that the filter tag creates a new context scope
  • TwigPHP filter tag implementation creates a new context scope, which is a bug
  • Suddenly, you decide to change the specifications to match the faulty implementation of TwigPHP

What is the rational behind that behavior? Is it assumed at Twig, SensioLabs or whatever entity is behing Twig specifications that when TwigPHP is faulty, then it is not faulty? How are other Twig implementations supposed to guess what is a faulty behavior if the documentation and the test suite can't be used as reference?

Bonus question: when will you release the language specifications publicly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions