-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Fix cloned lazy services not sharing their dependencies when dumped with PhpDumper #59723
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
[DependencyInjection] Fix cloned lazy services not sharing their dependencies when dumped with PhpDumper #59723
Conversation
src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_wither_lazy.php
Outdated
Show resolved
Hide resolved
cba91d9
to
9ea5995
Compare
Updated. I don't think the failing tests are related. |
src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
Show resolved
Hide resolved
...ymfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks, just some CS tweaks needed.
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainerInterface.php
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainer.php
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/DependencyContainer.php
Outdated
Show resolved
Hide resolved
9ea5995
to
c93c0d5
Compare
Resolved style comments |
Note that when using native proxies, cloning will trigger initialization. (The patch is still fixing a valid concern since we're not coupled to one implementation) |
…ndencies when dumped with PhpDumper
c93c0d5
to
a60cff5
Compare
Thank you @pvandommelen. |
Thanks for the quick reviews! |
Fixes referenced services not being shared when lazy services are cloned before being initialized. Adds tests for both the ghost and proxy scenario's.
This makes the inlining behaviour more conservative, which impacts the outputs of some other test cases.
First commit adds a test, second commit has the fix. Third commit also considers the proxy case, which is also affected. I can squash if necessary.
Targeted 6.4, but this also applies to 7.x.