Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Dec 6, 2019

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:

).

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.

@fancyweb fancyweb force-pushed the fwb-lint-command-reset-bundles branch from 6d61e43 to 31975e4 Compare December 6, 2019 19:07
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Dec 7, 2019
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

nicolas-grekas added a commit that referenced this pull request Dec 10, 2019
…es 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
-------

31975e4 [FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared
@nicolas-grekas nicolas-grekas merged commit 31975e4 into symfony:4.4 Dec 10, 2019
@fancyweb fancyweb deleted the fwb-lint-command-reset-bundles branch December 10, 2019 10:49
This was referenced Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants