bug #34862 [FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared (fancyweb)
bug #34862 [FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Some bundles extensions are "instances dependents", eg they cache service registrations (eg: https://github.com/symfony/symfony/blob/70dec3c8a39181dcf403fb54b92c065f55edfa3c/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L743).

Launching the lint command loads all bundles a first time, just to be able to run the command.

Then, when we build the container again for the lint command, it loads all bundles a second time. But since it's the same bundles instances, some services are not registered, leading to missing services in `CheckExceptionOnInvalidReferenceBehaviorPass`.

Commits
-------

31975e4981 [FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared

symfony/framework-bundle