Problem/Motivation

New releases is out with few api additions but primary fix is compatibility new PHP versions

- https://github.com/twigphp/Twig/commit/fba01bfba2640f98ae24272bb021de7f3...
- https://github.com/twigphp/Twig/commit/406b3e5969752cfd01da58d61b7e28d62...

also Drupal integration is re-enabled https://github.com/twigphp/Twig/commit/589655c1b930fa940beef243e760a2141...

Proposed resolution

Upgrade twig to 3.5.0 and set constraint to ^3.5.0

As 3.5.0 release improves forward-compatibility with PHP 8.0.24 and 8.1.11 it makes sense to backport it to 9.5.x amd 10.0.x

Remaining tasks

- review/commit
- decide about backport

User interface changes

no

API changes

no, additions only

Data model changes

no

Release notes snippet

Drupal 10.1.0

(The standard note about all deps being updated to the latest minors with constraint increased)

Drupal 10.0.1

Twig 3.5.0 has been released with improvements to PHP 8 compatibility. Drupal core and the drupal/core-recommended metapackage have been updated to use this version of Twig.

White it is unlikely, some sites or applications could encounter issues with a minor-version update of Twig in a patch release. The minimum required version remains Twig 3.4.3, so sites experiencing any issues with the 3.5.0 update can temporarily depend directly on drupal/core to require the old version until any conflict is resolved.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chi created an issue. See original summary.

Chi’s picture

Issue summary: View changes
Chi’s picture

Title: Update Twig to 1.40.1 » Update Twig to 1.41
Issue summary: View changes
amjad1233’s picture

Status: Active » Needs work

Hi @chi,

I ran composer show on twig/twig package it says it's at v1.42.3 already?

Do we need to still update it?

➜  drupal git:(8.9.x) ✗ composer show | grep twig
twig/twig                            v1.42.3            Twig, the flexible, fast, and secure template language for PHP
Chi’s picture

I ran composer show on twig/twig package it says it's at v1.42.3 already?

That's because Composer by default installs the latest allowed version. This issue is about setting minimum requirement for Twig which is currently 1.38.2.

Chi’s picture

Status: Needs work » Needs review
FileSize
2.35 KB
andypost’s picture

Meantime patch upgrades twig to v1.42.4

Chi’s picture

@andypost 1.42.4 gets into composer.lock as it is the latest Twig 1 release. The version specified in composer.json is "^1.41.0".

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Taran2L’s picture

Version: 9.1.x-dev » 8.9.x-dev

D9 is using Twig 2.x; so this is definitely a D8.9 target; however, I guess there should be an issue with updating all the dependencies

Taran2L’s picture

So, this patch must update the required minimal twig version alone; and should not touch composer.lock(s). See #3122112: Update dependencies for Drupal 8.9

The question is what minimum version we would like to require: 1.41 or newer

Taran2L’s picture

Status: Needs review » Needs work
arpad.rozsa’s picture

Status: Needs work » Needs review
FileSize
464 bytes

I think 1.41 is a good start, based on the issue description. Although 1.43.0 is out already, which we could use as a minimum. It drops php 5 and 7.0 support, but drupal 8.9 doesn't support those either so that shouldn't be a problem.

Uploading a patch with 1.41 for now (removed composer.lock changes), just so I can use it in a project.

Status: Needs review » Needs work

The last submitted patch, 13: twig-1.41-3095099-13.patch, failed testing. View results

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Title: Update Twig to 1.41 » Require Twig >= 3.5.0
Version: 9.5.x-dev » 10.1.x-dev
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Twig +10.1.0 release notes
FileSize
3.41 KB

re-purposed the issue for current upgrade as it was outdated

Spokje’s picture

Status: Needs review » Reviewed & tested by the community

- 3.5.0 is the current latest version https://packagist.org/packages/twig/twig
- Patch only updates twig/twig to that version
- TestBot is happily green

RTBC for me.

catch’s picture

Title: Require Twig >= 3.5.0 » [backport?] Require Twig >= 3.5.0
Version: 10.1.x-dev » 10.0.x-dev

Committed/pushed to 10.1.x, thanks!

We wouldn't normally update to a minor version of a dependency in a patch version of core, but it would help us if there's a security release probably, so leaving open for discussion. Maybe we could update but continue allowing the older version in composer.json?

catch’s picture

I've opened a new issue for the 9.5 update since it'll need its own release note and etc. #3330465: Update Twig to 2.15.4.

  • catch committed 8a9b8a2a on 10.1.x
    Issue #3095099 by Chi, andypost, arpad.rozsa: Require Twig >= 3.5.0
    
xjm’s picture

We should consider asking them if they'd backport the PHP 8 compatibility fixes to Twig 3.4 before we backport a minor update to 10.0.x.

alexpott’s picture

I've looked at https://github.com/twigphp/Twig/compare/v3.4.3...v3.5.0 and I think it is safe to update to 3.5.0 in the next patch release of Drupal. There are only additions and I couldn't spot any deprecations of changes that are consequential in terms of API change.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +10.0.1 release notes, +Needs release note

In that's case, let's do a lockfile-only update for 10.0.x now, before the patch release, with the Composer command to update core-recommended in the release notes.

alexpott’s picture

Status: Needs work » Needs review
FileSize
2.33 KB

Here's a patch for Drupal 10.0.x.

As per @xjm no change to core/composer.json so people can keep on the old minor if necessary.

Spokje’s picture

Status: Needs review » Reviewed & tested by the community

RTBC if TestBot agrees

xjm’s picture

Issue summary: View changes
Issue tags: -Needs release note

Wrote a proper release note.

xjm’s picture

Issue summary: View changes
xjm’s picture

Issue summary: View changes
xjm’s picture

xjm’s picture

Title: [backport?] Require Twig >= 3.5.0 » Update Twig to 3.5.0

  • xjm committed e9f53783 on 10.0.x
    Issue #3095099 by Chi, andypost, alexpott, arpad.rozsa, xjm, catch:...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Committed the backport to 10.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

xjm’s picture

This change is covered by the standard minor release note of:

Drupal core's pinned Composer dependency versions have been updated for the latest minor and patch releases.
Additionally, Drupal core’s composer constraints have been increased to require the latest minor version for forward compatibility. This ensures that if any composer package that Drupal core depends upon has a security release, the Drupal core security update will be non-disruptive, because if possible no minor version increase will occur for the affected dependency, only a patch version increase.