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

Fix for a problem with Service Manager and Abstract Factories #4285

Closed

Conversation

iquabius
Copy link
Contributor

When a abstract factory, inside the method canCreateServiceWithName(), try to check or retrieve a service that doesn't exists, a loop is created between the service manager and the given factory - see the test to get a better idea.

I'm not sure if my fix is a good one, but that's everything I can do. If someone else have a better approach to solve this, please feel free to fix it. :)

My idea was to skip the abstract factory when it, coupled with the canonical name, was the last one to be used.

* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ServiceManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove @Package

weierophinney added a commit that referenced this pull request Apr 22, 2013
Fix for a problem with Service Manager and Abstract Factories
weierophinney added a commit that referenced this pull request Apr 22, 2013
@ghost ghost assigned weierophinney Apr 22, 2013
@turrsis
Copy link
Contributor

turrsis commented Oct 6, 2013

In unut tests, for get one service once, TrollAbstractFactory::canCreateServiceWithName menthod will be called 6 times

@Ocramius
Copy link
Member

Ocramius commented Oct 6, 2013

@turrsis that's way too few information to start debugging the problem

@turrsis
Copy link
Contributor

turrsis commented Oct 6, 2013

@Ocramius I'll examine this question now

@turrsis
Copy link
Contributor

turrsis commented Oct 7, 2013

@Ocramius I've seen this problem on the other side, see #5237

@stefanotorresi
Copy link
Contributor

this is still reproducible.

I've added the test in #5390.

stefanotorresi pushed a commit to stefanotorresi/zf2 that referenced this pull request Oct 31, 2013
weierophinney added a commit to zendframework/zend-servicemanager that referenced this pull request May 15, 2015
…endServiceManager

Fix for a problem with Service Manager and Abstract Factories
weierophinney added a commit to zendframework/zend-servicemanager that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-servicemanager that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-servicemanager that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants