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

The DiAbstractServiceFactory causes recursion #186

Open
YevSent opened this issue Mar 17, 2017 · 1 comment
Open

The DiAbstractServiceFactory causes recursion #186

YevSent opened this issue Mar 17, 2017 · 1 comment

Comments

@YevSent
Copy link

YevSent commented Mar 17, 2017

I'm using the \Zend\ServiceManager\Di\DiAbstractServiceFactory to initialize objects and resolve their dependencies. But I have an issue with recursion in the \Zend\ServiceManager\ServiceManager::has.

I've added the \Zend\ServiceManager\Di\DiAbstractServiceFactory (it's also not a trivial task because service manager calls new during abstract factory initialization) to list of abstract factories.

During object initialization by ServiceManager via DiAbstractServiceFactory the \Zend\ServiceManager\Di\DiServiceFactory::get will be called to create the object and this method calls \Zend\ServiceManager\ServiceManager::has to check if ServiceManager can create this object; in its turn ServiceManager will check if configured abstract factories have possibility to create this object.

This behavior in the couple of \Zend\ServiceManager\Di\DiServiceFactory::get implementation causes the circular recursion. The previous implementation of \Zend\ServiceManager\ServiceManager::has was smarter and didn't have this issue.

Specifying \Zend\ServiceManager\Di\DiServiceFactory::USE_SL_AFTER_DI during DiAbstractServiceFactory doesn't solve this issue because other dependencies cannot be resolved.

zend-servicemanager-di 1.1.0
zend-servicemanager 3.3.0

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at https://github.com/laminas/laminas-servicemanager/issues/16.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants