Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Lazy load EscaperRuntime in EscaperExtension#4795

Merged
fabpot merged 1 commit into
twigphp:3.xtwigphp/Twig:3.xfrom
GromNaN:lazy-escaper-runtimeGromNaN/Twig:lazy-escaper-runtimeCopy head branch name to clipboard
May 17, 2026
Merged

Lazy load EscaperRuntime in EscaperExtension#4795
fabpot merged 1 commit into
twigphp:3.xtwigphp/Twig:3.xfrom
GromNaN:lazy-escaper-runtimeGromNaN/Twig:lazy-escaper-runtimeCopy head branch name to clipboard

Conversation

@GromNaN
Copy link
Copy Markdown
Contributor

@GromNaN GromNaN commented Apr 30, 2026

This allows overriding EscaperRuntime via a custom runtime loader.

Previously, EscaperExtension::setEnvironment() was calling $environment->getRuntime(EscaperRuntime::class) eagerly. Since this method is called from Environment::__construct(), the runtime was resolved before any custom runtime loader could be injected, making it impossible to override EscaperRuntime.

@GromNaN GromNaN force-pushed the lazy-escaper-runtime branch from 69af2b7 to 7931fdd Compare April 30, 2026 11:36
Previously, setEnvironment() called getRuntime(EscaperRuntime::class) eagerly,
which prevented overriding EscaperRuntime via a custom runtime loader since
Environment::__construct() calls setEnvironment() before any loader can be injected.
@fabpot
Copy link
Copy Markdown
Contributor

fabpot commented May 17, 2026

Thank you @GromNaN.

@fabpot fabpot merged commit fd0760d into twigphp:3.x May 17, 2026
39 of 41 checks passed
@GromNaN GromNaN deleted the lazy-escaper-runtime branch May 17, 2026 08:14
nicolas-grekas pushed a commit to symfony/symfony that referenced this pull request May 19, 2026
nicolas-grekas added a commit to symfony/symfony that referenced this pull request May 19, 2026
…vice definition (GromNaN)

This PR was merged into the 8.1 branch.

Discussion
----------

[TwigBridge] Require Twig to 3.25 for `EscaperRuntime` service definition

| Q             | A
| ------------- | ---
| Branch?       | 8.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

The feature introduced by #63929 is broken with older versions of Twig. The patch twigphp/Twig#4795 was released in [v3.25.0](https://github.com/twigphp/Twig/releases/tag/v3.25.0)

Commits
-------

f2bb4df [TwigBridge] Update required twig version for EscaperRuntime service definition
symfony-splitter pushed a commit to symfony/twig-bridge that referenced this pull request May 19, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.