Heya, Are you able to convert this to a PR with the failing test case attached?
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 17 December 2012 13:46, richard [via Zend Framework Community] < [email protected]> wrote: > Example test: > > class notSharedByDefault extends ServiceManager > { > protected $shareByDefault = false; > } > > public function testDuplicateNewInstanceMultipleAbstractFactories() > { > $this->serviceManager = new notSharedByDefault(); > > $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\BarAbstractFactory'); > > > $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); > > $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', > $this->serviceManager->get('bar')); > $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', > $this->serviceManager->get('bar')); > } > > The first instance of Bar is created. The second instance of Bar cannot be > created. The FooAbstractFactory adds a > $this->pendingAbstractFactoryRequests which then prevents > canCreateFromAbstractFactory returning true where it should. > > This appears to be due to lines 892/893 in > Zend\ServiceManager\ServiceManager: > $this->pendingAbstractFactoryRequests[get_class($abstractFactory)] = > $requestedName; > if ($abstractFactory->canCreateServiceWithName($this, $canonicalName, > $requestedName)) { > > This also appears to be fixable by reversing the order of lines 892/893 : > if ($abstractFactory->canCreateServiceWithName($this, $canonicalName, > $requestedName)) { > $this->pendingAbstractFactoryRequests[get_class($abstractFactory)] = > $requestedName; > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://zend-framework-community.634137.n4.nabble.com/BUG-Service-Manager-Not-Shared-Duplicate-new-Instance-with-multiple-Abstract-Factories-tp4658508.html > To start a new topic under Zend Framework, email > [email protected] > To unsubscribe from Zend Framework Community, click > here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4> > . > NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Re-BUG-Service-Manager-Not-Shared-Duplicate-new-Instance-with-multiple-Abstract-Factories-tp4658510.html Sent from the Zend Framework mailing list archive at Nabble.com.
