Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC break in 2.11 when importing macros inside an embed #3045

Closed
pontus-mp opened this issue Jun 3, 2019 · 5 comments · Fixed by #3050
Closed

BC break in 2.11 when importing macros inside an embed #3045

pontus-mp opened this issue Jun 3, 2019 · 5 comments · Fixed by #3050

Comments

@pontus-mp
Copy link

Imports are no longer in scope inside nested blocks within embeds.
Example: https://twigfiddle.com/fhfwr0
The block "inner" causes it to fail. The example works fine before Twig 2.11.

@fabpot
Copy link
Contributor

fabpot commented Jun 3, 2019

It worked by chance (and was not documented). Making it work with the new implementation is quite impossible. I've just tried.

You can either move the import call outside of the block call or duplicate the call in the "sub-"block.

@pontus-mp
Copy link
Author

Alright, that's understandable. Would it be possible to catch this during linting instead?

@fabpot
Copy link
Contributor

fabpot commented Jun 4, 2019

@pontus-mp That might be possible to catch this situation with the AST, but I don't think this is worth it. That would be (I think) quite a huge work.

@pontus-mp
Copy link
Author

Okay, in that case the only thing I can think of is a line or two of documentation that this behavior no longer works. We assumed that imports were scoped in blocks similarly to "curly brace"-scopes in programming languages, so others might have done the same thing.

@fabpot fabpot mentioned this issue Jun 4, 2019
@fabpot
Copy link
Contributor

fabpot commented Jun 4, 2019

see #3050

@fabpot fabpot closed this as completed Jun 4, 2019
fabpot added a commit that referenced this issue Jun 4, 2019
This PR was merged into the 2.x branch.

Discussion
----------

Add a doc note

closes #3045

Commits
-------

ee7be2e added a doc note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants