Skip to content

Commit be5bff3

Browse files
[DI] Fix circular reference when using setters
1 parent a19d1e5 commit be5bff3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,22 +353,18 @@ private function analyzeCircularReferences(array $edges, &$checkedNodes, &$curre
353353
$node = $edge->getDestNode();
354354
$id = $node->getId();
355355

356-
if (isset($checkedNodes[$id])) {
357-
continue;
358-
}
359-
$checkedNodes[$id] = true;
360-
361356
if ($node->getValue() && ($edge->isLazy() || $edge->isWeak())) {
362357
// no-op
363358
} elseif (isset($currentPath[$id])) {
364359
foreach (array_reverse($currentPath) as $parentId) {
365360
$this->circularReferences[$parentId][$id] = $id;
366361
$id = $parentId;
367362
}
368-
} else {
363+
} elseif (!isset($checkedNodes[$id])) {
364+
$checkedNodes[$id] = true;
369365
$currentPath[$id] = $id;
370366
$this->analyzeCircularReferences($node->getOutEdges(), $checkedNodes, $currentPath);
371-
array_pop($currentPath);
367+
unset($currentPath[$id]);
372368
}
373369
}
374370
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy