Skip to content

Reject template wrappers from another environment - #4910

Open
fabpot wants to merge 1 commit into
twigphp:3.xfrom
fabpot:reject-cross-environment-template-wrapper
Open

Reject template wrappers from another environment#4910
fabpot wants to merge 1 commit into
twigphp:3.xfrom
fabpot:reject-cross-environment-template-wrapper

Conversation

@fabpot

@fabpot fabpot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Twig now rejects TemplateWrapper instances created by another Environment.

This prevents templates from unexpectedly using another environment's loader, extensions, globals, or sandbox policy.

@stof

stof commented Aug 28, 2026

Copy link
Copy Markdown
Member

This will break the Symfony form renderer, which relies on the internal API: https://github.com/symfony/symfony/blob/f1072d8902e3d397ab5f9190877fb947d259b0c3/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php#L142

It might make sense to first refactor Symfony to stop using the internal API (which will be safer regarding semver guarantees)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants