Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hotfix/3237' into develop

Forward port #3237
  • Loading branch information...
commit ff05338dbc04b5198dac43f5e8c1c04ea604c9ae 2 parents 0de645c + 60a0760
@weierophinney weierophinney authored
View
2  library/Zend/ServiceManager/ServiceManager.php
@@ -892,8 +892,8 @@ protected function createFromAbstractFactory($canonicalName, $requestedName)
));
}
try {
- $this->pendingAbstractFactoryRequests[get_class($abstractFactory)] = $requestedName;
if ($abstractFactory->canCreateServiceWithName($this, $canonicalName, $requestedName)) {
+ $this->pendingAbstractFactoryRequests[get_class($abstractFactory)] = $requestedName;
$instance = $this->createServiceViaCallback(
array($abstractFactory, 'createServiceWithName'),
$canonicalName,
View
13 tests/ZendTest/ServiceManager/ServiceManagerTest.php
@@ -654,4 +654,17 @@ public function testCanGetAliasedServicesFromPeeringServiceManagers()
$this->assertSame($service, $this->serviceManager->get('alias-name'));
}
+
+ /**
+ * @covers Zend\ServiceManager\ServiceManager::get
+ */
+ public function testDuplicateNewInstanceMultipleAbstractFactories()
+ {
+ $this->serviceManager->setAllowOverride(true);
+ $this->serviceManager->setShareByDefault(false);
+ $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'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.