bug #29393 [DI] fix edge case in InlineServiceDefinitionsPass (nicolas-grekas)

This PR was merged into the 4.1 branch.

Discussion
----------

[DI] fix edge case in InlineServiceDefinitionsPass

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Looks like this can happen - dunno how
https://stackoverflow.com/questions/53558247/autowire-services-test-yaml-there-is-no-node-with-id-service-a

Commits
-------

8bd2bbfb1c [DI] fix edge case in InlineServiceDefinitionsPass
This commit is contained in:
Nicolas Grekas 2018-12-01 09:16:32 +01:00
commit 21db588157
1 changed files with 4 additions and 4 deletions

View File

@ -92,6 +92,10 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
return false;
}
if (!$graph->hasNode($id)) {
return true;
}
if (!$definition->isShared()) {
foreach ($graph->getNode($id)->getInEdges() as $edge) {
if ($edge->isWeak()) {
@ -106,10 +110,6 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
return false;
}
if (!$graph->hasNode($id)) {
return true;
}
if ($this->currentId == $id) {
return false;
}