Skip to content

Commit 62bae7c

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: Mitigate PHPUnit deprecations [TwigBundle] Add support for resetting globals between HTTP requests [Process] Fix backwards compatibility for invalid commands Mitigate PHPUnit deprecations [Cache] Fix compatibility with Redis 6.1.0 pre-releases [Validator] Add Catalan and Spanish translation for `Week` constraint Don't use is_resource() on non-streams [Ldap] Fix extension deprecation
2 parents c0ec7e9 + 4e6afd0 commit 62bae7c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

DependencyInjection/TwigExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Symfony\Component\Translation\LocaleSwitcher;
2626
use Symfony\Component\Translation\Translator;
2727
use Symfony\Contracts\Service\ResetInterface;
28+
use Twig\Environment;
2829
use Twig\Extension\ExtensionInterface;
2930
use Twig\Extension\RuntimeExtensionInterface;
3031
use Twig\Loader\LoaderInterface;
@@ -42,6 +43,10 @@ public function load(array $configs, ContainerBuilder $container): void
4243
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
4344
$loader->load('twig.php');
4445

46+
if (method_exists(Environment::class, 'resetGlobals')) {
47+
$container->getDefinition('twig')->addTag('kernel.reset', ['method' => 'resetGlobals']);
48+
}
49+
4550
if ($container::willBeAvailable('symfony/form', Form::class, ['symfony/twig-bundle'])) {
4651
$loader->load('form.php');
4752

0 commit comments

Comments
 (0)