Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Drupal's Dependency Injection container is based on the Symfony project's DI component, with the biggest difference being that Drupal's compiled DI container is serialized to the database and not dumped to disk.
In addition, there are:
- features added to the upstream project and not yet implemented in Drupal or
- features overridden or suppressed in Drupal which may be eligible to be harmonized with upstream.
This is a meta issue for the broad goal of reducing differences from upstream, and allowing developers to be referred to the Symfony DI docs by default.
Proposed resolution
Add child issues to improve compatibility
Remaining tasks
fix all child issues
User interface changes
no
API changes
To be announced
Data model changes
no
Release notes snippet
no
Comments
Comment #2
andypostComment #4
neclimdulHope this is the right issue to surface this. This week I learned Drupal's containers have not mutation protections meaning services can end up with different versions of injected services. Kinda scary.
This led to a lot of reviewing ContainerBuilder::set
#2498293: Only allow lowercase service and parameter names
https://symfony.com/blog/new-in-symfony-3-3-dependency-injection-depreca...
Mentioned it in the CB:set issue but similarly our Container::set contains none of the logic from Symfony's Container::set which mean it _also_ doesn't have any its mutation protections. Means you can modify containers mid request to dangerous effect. Since it doesn't inherit from Symfony's container that might be a much bigger lift and I haven't opened anything yet.
Comment #5
andypostit smells like major bug (#4)
Comment #6
louis-cuny CreditAttribution: louis-cuny at Daille-daille commentedIndeed, this other issue will depend on this one.
https://www.drupal.org/project/drupal/issues/2218651
I already tryed to explain an issue with values that are kept from one request to another:
https://www.drupal.org/project/drupal/issues/3215035
Comment #7
andypostAdded new child #2366129: RegisterStreamWrappersPass and other have broken compiler pass for multiple tags
Comment #8
andypostCommitted #2937010: Bring ContainerBuilder inline with Symfony Container and apply upstream improvements
Comment #9
andypostThe biggest change is in #2531564: Fix leaky and brittle container serialization solution
Comment #10
Wim LeersIt's not clear from this meta's issue summary what remains to be done? 😅 Maybe everything's done? 🤞
Comment #11
andypostThere's a set of child issues and this plan is more like tracker for changes
Updated IS a bit to point it
Comment #12
longwaveIs this just a duplicate of #3021900: Bring new features from Symfony 3/4/5/6 into our container though? Should that become a parent meta?
Comment #13
andypost#3021900: Bring new features from Symfony 3/4/5/6 into our container looks more like child one with own sub tasks
Comment #16
kim.pepperLinked child issue #2961380: Support IteratorArgument in \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::dumpValue
Comment #17
vacho CreditAttribution: vacho at Skilld commented