diff --git a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php index ae3e57a67ee8bee105260252fc6c3c540af93009..9f510781fbb553b632f5df1056200ae29e68413e 100644 --- a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php +++ b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php @@ -27,8 +27,8 @@ class ContainerBuilder extends SymfonyContainerBuilder { * {@inheritdoc} */ public function __construct(ParameterBagInterface $parameterBag = NULL) { - $this->setResourceTracking(FALSE); parent::__construct($parameterBag); + $this->setResourceTracking(FALSE); } /** diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php index 51629a5aabffdf393ba411b863203f44017cb1b2..e8de5ecf59ac382af67424c33847bbbb2b0a33ef 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php @@ -118,4 +118,27 @@ public function testSerialize() { serialize($container); } + /** + * Tests constructor and resource tracking disabling. + * + * This test runs in a separate process to ensure the aliased class does not + * affect any other tests. + * + * @runInSeparateProcess + * @preserveGlobalState disabled + */ + public function testConstructor() { + class_alias(testInterface::class, 'Symfony\Component\Config\Resource\ResourceInterface'); + $container = new ContainerBuilder(); + $this->assertFalse($container->isTrackingResources()); + } + +} + +/** + * A test interface for testing ContainerBuilder::__construct(). + * + * @see \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testConstructor() + */ +interface testInterface { }