[DepdenencyInjection] Prevent self-referencing aliases
This commit is contained in:
parent
b3cb02adf2
commit
98e035b963
@ -427,6 +427,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
throw new \InvalidArgumentException('$id must be a string, or an Alias object.');
|
throw new \InvalidArgumentException('$id must be a string, or an Alias object.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($alias === strtolower($id)) {
|
||||||
|
throw new \InvalidArgumentException('An alias can not reference itself, got a circular reference on "'.$alias.'".');
|
||||||
|
}
|
||||||
|
|
||||||
unset($this->definitions[$alias]);
|
unset($this->definitions[$alias]);
|
||||||
|
|
||||||
$this->aliases[$alias] = $id;
|
$this->aliases[$alias] = $id;
|
||||||
|
Reference in New Issue
Block a user