Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Problem/Motivation
We're not disabling tracking of resources properly in \Drupal\Core\DependencyInjection\ContainerBuilder::__construct(). This can create unexpected differences in the container.
Proposed resolution
Swap the order of calls.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#5 | 2940956-5.patch | 1.73 KB | alexpott |
#5 | 3-5-interdiff.txt | 685 bytes | alexpott |
#3 | 2940956-3.patch | 1.73 KB | alexpott |
#3 | 2-3-interdiff.txt | 1.13 KB | alexpott |
#2 | 2940956-2.patch | 1.45 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottLet's isolate the test so the class alias can not impact any other test or anything else.
Comment #5
alexpottDoh a typo slipped in.
Comment #6
alexpottThe constructor was added in #2284103: Remove the request from the container. The diff was:
This was fine up until Symfony 2.6 but was changed in 2.7. At the time of #2284103: Remove the request from the container we were on
"symfony/dependency-injection": "2.4.*",
Comment #7
alexpottAdding some related issues for completeness.
Comment #8
Berdir> This can create unexpected differences in the container.
Would be helpful to describe how exactly.
I can see on the docblock of the method something about not using symfony/config, which we certainly aren't. The parent uses "$this->trackResources = interface_exists('Symfony\Component\Config\Resource\ResourceInterface');". So my guess is that this is not a problem with plain core as we don't have that class. However, on an actual project, I see that we have that because behat as well as console-core depend on it.
Nice trick in the test with the class alias :)
Comment #10
larowlanCommitted 33e0ba3 and pushed to 8.6.x
Cherry-picked as 7da71a2 and pushed to 8.5.x