twig/twig 3.11.0 introduces (for Drupal) breaking changes

Created on 10 August 2024, 4 months ago
Updated 31 August 2024, 4 months ago

Problem/Motivation

twig/twig Released version 3.11.0 (See https://github.com/twigphp/Twig/releases/tag/v3.11.0)

In it they dropped \Twig\Environment::$templateClassPrefix and hard-coded it to its previous default value '__TwigTemplate_'. (See https://github.com/twigphp/Twig/commit/215f9880f1bbd10cf01317c4cb1b40a4e...)

This makes core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php fail with a merry

Drupal\KernelTests\Core\Theme\TwigEnvironmentTest::testTemplateInvalidation
ReflectionException: Property Twig\Environment::$templateClassPrefix does not exist

core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php:227

EDIT: After fixing the above, deprecation warnings pop-up which we suppress in this issue and fix in a follow-up

Steps to reproduce

Take a look at the test results of the daily 'Updated deps' run, like this one: failed run

Proposed resolution

Since we're testing a not-really-feasible-to-happen-in-real-life-situation in that test, see comment above the failing bit in the test below, I think it's OK to remove the lines that fail from the test.

This wouldn't be a problem on a real site where you reload the page.

Also I think we need to bump the version of twig/twig in our composer.*.
Removing a test will certainly pass on previous versions, but also we don't provide test-coverage for that specific bit in versions lower than version 3.11.0.

Also suppress the deprecation warning in core/.deprecation-ignore.txt that shows after we do the above.
There's a follow-up here to deal with that properly πŸ“Œ [PP-1] twig/twig 3.11.0 introduces (for Drupal) breaking changes Postponed

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.4 ✨

Component
BaseΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡±Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024