Skip to content

Commit

Permalink
fixed a circular call (closes #6864)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 4, 2013
1 parent 115114b commit 74f2fcf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Expand Up @@ -952,23 +952,25 @@ private function getDefinitionsFromArguments(array $arguments)
*
* @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) {
if ($id === (string) $argument) {
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;
}
}
Expand Down

0 comments on commit 74f2fcf

Please sign in to comment.