Update to Symfony 6.4

Created on 9 October 2023, 9 months ago
Updated 28 February 2024, 4 months ago

Problem/Motivation

Symfony 6.4 will be released in November 2023 (https://symfony.com/releases/6.4).

Steps to reproduce

Proposed resolution

Start updating now to Symfony 6.4 to see what deprecations, if any, we need to fix.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.2

Component
Base 

Last updated 31 minutes ago

Created by

🇳🇱Netherlands Spokje

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

Comments & Activities

  • Issue created by @Spokje
  • last update 9 months ago
    Custom Commands Failed
  • @spokje opened merge request.
  • 🇳🇱Netherlands Spokje

    Ok, so the first let's-see-what-breaks-run stops at PHPStan complaining about https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md#dependencyinj....

  • last update 9 months ago
    19,800 pass, 3,057 fail
  • last update 9 months ago
    29,910 pass, 33 fail
  • last update 9 months ago
    30,170 pass, 14 fail
  • last update 9 months ago
    30,354 pass, 3 fail
  • 🇳🇱Netherlands Spokje

    What Have We (or at least I) Learned So Far:

    - SF6.4 deprecates ContainerAwareTrait and ContainerAwareInterface.
    This affects:

    core/lib/Drupal/Core/Access/CheckProvider.php                       
    core/lib/Drupal/Core/Cache/CacheFactory.php                           
    core/lib/Drupal/Core/Cache/CacheTagsInvalidator.php                 
    core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php            
    core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php  
    core/lib/Drupal/Core/DependencyInjection/ClassResolver.php          
    core/lib/Drupal/Core/DrupalKernelInterface.php                  
    core/lib/Drupal/Core/Entity/EntityTypeManager.php                   
    core/lib/Drupal/Core/EventSubscriber/KernelDestructionSubscriber.php  
    core/lib/Drupal/Core/Logger/LoggerChannelFactory.php                 
    core/lib/Drupal/Core/Queue/QueueFactory.php                           
    core/lib/Drupal/Core/StackMiddleware/Session.php                    
    core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php         
    core/lib/Drupal/Core/Update/UpdateHookRegistryFactory.php           
    core/lib/Drupal/Core/Update/UpdateRegistryFactory.php                 
    core/modules/book/src/Cache/BookNavigationCacheContext.php          
    core/modules/media_library/src/OpenerResolver.php                   
    core/modules/system/tests/modules/render_placeholder_message_test/src/RenderPlaceholderMessageTestController.php  
    core/modules/system/tests/modules/service_provider_test/src/TestClass.php  
    core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php  
    core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php  
    core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php
    
    core/modules/book/src/Cache/BookNavigationCacheContext.php          
    core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php  
    

    seem likely candidates for becoming Service Subscribers?

    - ComponentsIsolatedBuildTest doesn't like stability lowering
    - ComposerProjectTemplatesTest::testTemplateCreateProject seems to have problems with putting the set stability level into the version string.
    - ComposerProjectTemplatesTest::testMinimumStabilityStrictness seems to be having problems with not finding any 'dev' stability level since they are all in the excluded-from-comparing drupal/core

  • Issue was unassigned.
  • Status changed to Needs work 9 months ago
  • 🇬🇧United Kingdom catch

    Some of these can probably be service subscribers, but ClassResolver especially, definitely can't, so I think we need to fork ContainerAwareTrait or otherwise keep things more or less the same for that.

  • last update 9 months ago
    30,356 pass, 3 fail
  • 🇺🇸United States bradjones1 Digital Nomad Life

    Updating title to help with discoverability for both Symfony 6.4 and Symfony 7.0 searches.

    Marking 📌 Symfony 7 compatibility Active as a duplicate, however I am including the following note and encouraging anyone who can speak to Drupal's position on postponements of strong typing to chime in:

    Symfony 7 will include types on many methods, which requires that extending classes and interface implementations will need to be updated. There is an issue upstream Generate JSON schema for content entity types Needs review for collecting feedback, and with compatibility-checking steps.

  • last update 8 months ago
    30,426 pass
  • @spokje opened merge request.
  • 🇬🇧United Kingdom longwave UK

    We are planning to release Drupal 10.2 with Symfony 6.4, so I think we should get this in as-is and then work on the new deprecations in followup issues.

    I also think we need to figure out what to do with the Symfony 7 typing issue as we will have to follow suit for Drupal 11 and so we need to start making a plan for how to notify contrib/custom code now, that certainly deserves its own issue.

    MR needs rebasing against 10.2.x/11.x so leaving at needs work for now.

  • last update 8 months ago
    30,437 pass
  • Status changed to Needs review 8 months ago
  • 🇳🇱Netherlands Spokje

    Rebased as-is.

  • Status changed to RTBC 8 months ago
  • 🇬🇧United Kingdom longwave UK

    Thanks! Retitling this issue again as the remaining SF7 prep work will have to happen in followups.

  • 🇨🇭Switzerland Berdir Switzerland

    Should we have follow-ups to deal with the ContainerAware deprecation (and others if there are, didn't check)? This is still beta, do we want to commit it like this or wait for a stable release?

    We could either way start to work on the ContainerAware topic, likely with separate issues for any non-trivial conversion?

  • 🇬🇧United Kingdom longwave UK

    The stable Symfony release doesn't land until possibly the end of November, but we need to put out 10.2.0-beta1 before that and so it should be on the Symfony beta release as well; better than doing the upgrade afterwards. We've done this before for 10.0 and 10.1.

  • 🇬🇧United Kingdom longwave UK

    Let's open some followups grouped by type of deprecation if we can.

  • 🇳🇱Netherlands Spokje

    Can I have some "blessing" on splitting off an issue for converting BookNavigationCacheContext and MenuActiveTrailsCacheContext into lazy services?

    This won't do much with the whole ContainerAware deprecation, it just shifts it to another point.
    But by the looks of it, these two services are ContainerAware just for the lazy loading, and looking at the time of creation of both, we didn't really have the lazy services concept up and running.
    For consistency reasons, I think we should convert them into those, but unsure if the people in here agree, since we of course have to do a lot of construct deprecation dancing.

    For all the other deprecations, I agree with @catch in #8:

    so I think we need to fork ContainerAwareTrait or otherwise keep things more or less the same for that.

    Forking ContainerAwareTrait into core seems the only way to me. As far as I can see all deprecation added in this issue come from this deprecation, so there's not much to split IMHO, but happy (and easy) to be convinced otherwise :)

  • 🇬🇧United Kingdom longwave UK

    Yep it looks like those two can be converted to using lazy services, feel free to spin off issues for that.

    And yes I think realistically we need to fork ContainerAwareTrait as it seems unlikely we are not going to be able to remove all uses of that or ContainerAwareInterface before Drupal 11, although we should still try and convert as much as possible to using dependency injection. Perhaps we need one issue to copy the trait/interface into core, and another meta issue to reduce use of ContainerAware classes where possible.

  • last update 8 months ago
    30,441 pass
  • First commit to issue fork.
    • lauriii committed d582b8c5 on 11.x
      Issue #3392616 by Spokje, longwave: Update to Symfony 6.4
      
  • Status changed to Fixed 8 months ago
  • 🇫🇮Finland lauriii Finland

    Rebased the MR because there was a conflict in the composer.lock. Only change needed to resolve the rebase conflict was to update the hash.

    Committed d582b8c and pushed to 11.x. Also cherry-picked to 10.2.x. Thanks!

    I didn't add anything to the release notes because there was already section that mentions the Symfony update.

    • lauriii committed c02c22f7 on 10.2.x
      Issue #3392616 by Spokje, longwave: Update to Symfony 6.4
      
      (cherry...
  • Status changed to RTBC 8 months ago
  • 🇳🇱Netherlands Spokje

    Created child issues, remove tag.

  • Status changed to Fixed 8 months ago
  • 🇬🇧United Kingdom catch

    Moving back to fixed, I came here to commit this ;)

  • 🇳🇱Netherlands Spokje

    Damn keeping tabs open for too long and not refreshing!

    Sorry, also reverted the version back to 10.2.x-dev.

  • 🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

    @Spokje:

    Can I have some "blessing" on splitting off an issue for converting BookNavigationCacheContext and MenuActiveTrailsCacheContext into lazy services?

    I can review those when you get to them! 👍

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

  • Status changed to Fixed 4 months ago
  • 🇺🇸United States bkosborne New Jersey, USA
Production build 0.69.0 2024