diff --git a/src/ServiceManager.php b/src/ServiceManager.php index 89ce2ad0..91cf5ac9 100644 --- a/src/ServiceManager.php +++ b/src/ServiceManager.php @@ -477,7 +477,7 @@ protected function resolveAlias($cName) } $stack[$cName] = $cName; - $cName = $this->aliases[$cName]; + $cName = $this->aliases[$this->canonicalizeName($cName)]; } return $cName; diff --git a/test/ServiceManagerTest.php b/test/ServiceManagerTest.php index 716c9b91..31b9f445 100644 --- a/test/ServiceManagerTest.php +++ b/test/ServiceManagerTest.php @@ -245,6 +245,17 @@ public function testGetWithAlias() $this->assertEquals('bar', $this->serviceManager->get('baz')); } + /** + * @covers Zend\ServiceManager\ServiceManager::get + */ + public function testGetWithAliasofAliasWithCanonicalizedName() + { + $this->serviceManager->setService('Foo', 'Bar'); + $this->serviceManager->setAlias('Baz', 'Foo'); + $this->serviceManager->setAlias('Qux', 'Baz'); + $this->assertEquals('Bar', $this->serviceManager->get('Qux')); + } + /** * @covers Zend\ServiceManager\ServiceManager::get */