From 0193b220ac469e1766524abf6d893e70cc2cc14f Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Sat, 17 Aug 2024 19:52:21 +0900 Subject: [PATCH] Issue #3467293 by Spokje, longwave: twig/twig 3.11.0 introduces (for Drupal) breaking changes --- composer.lock | 19 ++++++++++--------- .../Metapackage/CoreRecommended/composer.json | 2 +- core/.deprecation-ignore.txt | 3 +++ core/composer.json | 2 +- .../Core/Theme/TwigEnvironmentTest.php | 12 ------------ 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/composer.lock b/composer.lock index 7f08ccf3f19..7e39a2777f4 100644 --- a/composer.lock +++ b/composer.lock @@ -495,7 +495,7 @@ "dist": { "type": "path", "url": "core", - "reference": "b8ae3e330a6035450fa1578a5d2d30388cb98314" + "reference": "db88cf782861d4f89a1e811ddaefcd797dec6942" }, "require": { "asm89/stack-cors": "^2.1", @@ -540,7 +540,7 @@ "symfony/serializer": "^6.4", "symfony/validator": "^6.4", "symfony/yaml": "^6.4", - "twig/twig": "^3.9.3" + "twig/twig": "^3.11.0" }, "conflict": { "drush/drush": "<12.4.3" @@ -4347,16 +4347,16 @@ }, { "name": "twig/twig", - "version": "v3.10.2", + "version": "v3.11.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "7aaed0b8311a557cc8c4047a71fd03153a00e755" + "reference": "e80fb8ebba85c7341a97a9ebf825d7fd4b77708d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/7aaed0b8311a557cc8c4047a71fd03153a00e755", - "reference": "7aaed0b8311a557cc8c4047a71fd03153a00e755", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e80fb8ebba85c7341a97a9ebf825d7fd4b77708d", + "reference": "e80fb8ebba85c7341a97a9ebf825d7fd4b77708d", "shasum": "" }, "require": { @@ -4364,7 +4364,8 @@ "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.22" + "symfony/polyfill-php80": "^1.22", + "symfony/polyfill-php81": "^1.29" }, "require-dev": { "psr/container": "^1.0|^2.0", @@ -4410,7 +4411,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.10.2" + "source": "https://github.com/twigphp/Twig/tree/v3.11.0" }, "funding": [ { @@ -4422,7 +4423,7 @@ "type": "tidelift" } ], - "time": "2024-05-14T06:04:16+00:00" + "time": "2024-08-08T16:15:16+00:00" } ], "packages-dev": [ diff --git a/composer/Metapackage/CoreRecommended/composer.json b/composer/Metapackage/CoreRecommended/composer.json index f3ee1d502d7..e3178120c49 100644 --- a/composer/Metapackage/CoreRecommended/composer.json +++ b/composer/Metapackage/CoreRecommended/composer.json @@ -61,6 +61,6 @@ "symfony/var-dumper": "~v6.4.7", "symfony/var-exporter": "~v6.4.7", "symfony/yaml": "~v6.4.7", - "twig/twig": "~v3.10.2" + "twig/twig": "~v3.11.0" } } diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index 9b307fe460d..656fd04b58b 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -62,3 +62,6 @@ %The "Drupal\\Tests\\Core\\Controller\\MockContainerAware" class implements "Symfony\\Component\\DependencyInjection\\ContainerAwareInterface" that is deprecated since Symfony 6.4, use dependency injection instead.% %The "Drupal\\Tests\\Core\\DependencyInjection\\DependencySerializationTestDummy" class implements "Symfony\\Component\\DependencyInjection\\ContainerAwareInterface" that is deprecated since Symfony 6.4, use dependency injection instead.% %The "Drupal\\Tests\\Core\\Utility\\MockContainerAware" class implements "Symfony\\Component\\DependencyInjection\\ContainerAwareInterface" that is deprecated since Symfony 6.4, use dependency injection instead.% + +# Twig 3.11.0 +%Since twig/twig 3.11: Changing the value of a "filter" node in a NodeVisitor class is not supported anymore.% diff --git a/core/composer.json b/core/composer.json index c899706d59a..520ca0c9cb7 100644 --- a/core/composer.json +++ b/core/composer.json @@ -33,7 +33,7 @@ "symfony/process": "^6.4", "symfony/polyfill-iconv": "^1.26", "symfony/yaml": "^6.4", - "twig/twig": "^3.9.3", + "twig/twig": "^3.11.0", "doctrine/annotations": "^1.14", "guzzlehttp/guzzle": "^7.5", "guzzlehttp/psr7": "^2.4.5", diff --git a/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php index 1552dc39a01..7f24496f24f 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php @@ -12,7 +12,6 @@ use Drupal\Core\Template\TwigEnvironment; use Drupal\Core\Template\TwigPhpStorageCache; use Drupal\KernelTests\KernelTestBase; use Symfony\Component\DependencyInjection\Definition; -use Twig\Environment; use Twig\Error\LoaderError; /** @@ -218,17 +217,6 @@ TWIG; file_put_contents($template_file, $template_after); $output = $environment->load(basename($template_file))->render(); $this->assertEquals($template_before, $output); - - $environment->invalidate(); - // Manually change $templateClassPrefix to force a different template - // classname, as the other class is still loaded. This wouldn't be a problem - // on a real site where you reload the page. - $reflection = new \ReflectionClass(Environment::class); - $property_reflection = $reflection->getProperty('templateClassPrefix'); - $property_reflection->setValue($environment, 'otherPrefix'); - - $output = $environment->load(basename($template_file))->render(); - $this->assertEquals($template_after, $output); } /**