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

The DiAbstractServiceFactory causes recursion #2

Closed
weierophinney opened this issue Dec 31, 2019 · 4 comments
Closed

The DiAbstractServiceFactory causes recursion #2

weierophinney opened this issue Dec 31, 2019 · 4 comments

Comments

@weierophinney
Copy link
Member

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


Originally posted by @joni-jones at zendframework/zend-servicemanager#186

@GeeH
Copy link

GeeH commented Jun 8, 2020

Does the Di Abstract Factory even exist any more? I don't see it under the new namespace.

@boesing
Copy link
Member

boesing commented Jun 8, 2020

@GeeH This should be referencing laminas/laminas-servicemanager-di.

I think this can be closed and re-created there?

@samsonasik samsonasik transferred this issue from laminas/laminas-servicemanager Jun 8, 2020
@samsonasik
Copy link
Member

@boesing I transfered the issue, there is button for that

@weierophinney
Copy link
Member Author

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee.
If you have a security issue, please follow our security reporting guidelines.
If you wish to take on the role of maintainer, please nominate yourself

You can now use laminas/laminas-di directly with laminas/laminas-servicemanager.

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

4 participants