zendframework/zf2 — pull request #5795 by bacinsky (2014-02-07 07:14:58+00:00)
Title: ServiceManager::canCreateFromAbstractFactory() missing foreach break after valid abstract factory found

It seems that in the ServiceManager::canCreateFromAbstractFactoryMethod() is missing foreach break after an abstract factory is found and assigned to the nestedContext.

Missing break after https://github.com/zendframework/zf2/blob/develop/library/Zend/ServiceManager/ServiceManager.php#L732

Now the issue is, that the first abstract factory if can create a service is always overridden with the last abstract factory that can create the same service, e.g. DiAbstractServiceFactory.

For example, I add an abstract factory to the service manager config AdapterAbstractServiceFactory and I configure the db adapter. When I want to inject that adapter with the Di, I have to configure the di instance alias. But, when the service manager is creating that db adapter new instance it continues over the AdapterAbstractServiceFactory to the DiAbstractServiceFactory, because of that missing foreach break. Thus db adapter instance can't be created,