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

The DiAbstractServiceFactory causes recursion #186

Open

Description

@YevSent

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

Activity

  1. weierophinney commented on Dec 31, 2019

    @weierophinney
    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions