Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Commit

Permalink
#83 - fix for issue #83 - avoiding infinite loops by skipping alias r…
Browse files Browse the repository at this point in the history
…esolution for already visited aliases
  • Loading branch information
Ocramius committed Jan 26, 2016
1 parent 7c27f4a commit 149ed56
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,15 @@ private function resolveInitializers(array $initializers)
private function resolveAliases(array $aliases)
{
foreach ($aliases as $alias => $service) {
$name = $alias;
// avoiding infinite loops by removing already resolved aliases
$currentAliases = $this->aliases;
$name = $alias;

while (isset($this->aliases[$name])) {
$name = $this->aliases[$name];
while (isset($currentAliases[$name])) {
$oldName = $name;
$name = $currentAliases[$name];

unset($currentAliases[$oldName]);
}

$this->resolvedAliases[$alias] = $name;
Expand Down

0 comments on commit 149ed56

Please sign in to comment.