-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] give access to non-shared services when using test.service_container #27528
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
Conversation
nicolas-grekas
commented
Jun 6, 2018
Q | A |
---|---|
Branch? | 4.1 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #27488 |
License | MIT |
Doc PR | - |
@@ -32,6 +32,10 @@ public function process(ContainerBuilder $container) | |||
|
|||
foreach ($definitions as $id => $definition) { | |||
if ($id && '.' !== $id[0] && (!$definition->isPublic() || $definition->isPrivate()) && !$definition->getErrors() && !$definition->isAbstract()) { | |||
if (!$definition->isShared()) { | |||
$definition->setShared(true); |
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.
wouldn't this cause issues regarding inlining ? Rules are not the same for shared and not shared services.
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.
It will change the resulting inlining yes that's the goal, but inlining is only an optimization: it has no external side effect, so this is neutral, behavior wise.
…service_container
a4dc1ee
to
516ff5a
Compare
Implementation updated, with logic added to the inlining pass: when a non-shared service is weak-referenced, it cannot be inlined. |
(deps=high failure will be fixed when this is merged up to master.) |
…using test.service_container (nicolas-grekas) This PR was merged into the 4.1 branch. Discussion ---------- [FrameworkBundle] give access to non-shared services when using test.service_container | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27488 | License | MIT | Doc PR | - Commits ------- 516ff5a [FrameworkBundle] give access to non-shared services when using test.service_container
…s are involved (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] fix inlining when non-shared services are involved | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43980 | License | MIT | Doc PR | - I'm unable to write a service graph that hits the bug, but this is still fixing the referenced issue appropriately. As a reminder, since #27528, we don't inline non-shared service as soon as they're referenced by a service locator. But when doing so, we need to ensure that the shared services referenced by such non-inlined-non-shared services are not themselves inlined, since that'd break the non-inlined-non-shared services. This patch does it :) Commits ------- 3ff048b [DependencyInjection] fix inlining when non-shared services are involved