merged branch fabpot/container-dumper-fix (PR #6959)
This PR was submitted for the 2.2 branch but it was merged into the 2.0 branch instead (closes #6959). Commits ------- ad889c9 [DependencyInjection] fixed a circular call (closes #6864) Discussion ---------- [DependencyInjection] fixed a circular call (closes #6864) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6864 | License | MIT | Doc PR | n/a
This commit is contained in:
commit
1eab5151b3
@ -952,11 +952,11 @@ EOF;
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
private function hasReference($id, array $arguments, $deep = false)
|
||||
private function hasReference($id, array $arguments, $deep = false, $visited = array())
|
||||
{
|
||||
foreach ($arguments as $argument) {
|
||||
if (is_array($argument)) {
|
||||
if ($this->hasReference($id, $argument, $deep)) {
|
||||
if ($this->hasReference($id, $argument, $deep, $visited)) {
|
||||
return true;
|
||||
}
|
||||
} elseif ($argument instanceof Reference) {
|
||||
@ -964,11 +964,13 @@ EOF;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($deep) {
|
||||
if ($deep && !isset($visited[(string) $argument])) {
|
||||
$visited[(string) $argument] = true;
|
||||
|
||||
$service = $this->container->getDefinition((string) $argument);
|
||||
$arguments = array_merge($service->getMethodCalls(), $service->getArguments(), $service->getProperties());
|
||||
|
||||
if ($this->hasReference($id, $arguments, $deep)) {
|
||||
if ($this->hasReference($id, $arguments, $deep, $visited)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user