Permalink
Browse files

Fixed bug in Zend\ModuleManager\Listener\LocatorRegistrationListener:…

… shared event manager can be false
  • Loading branch information...
1 parent e1c2044 commit 452d580e91b092587644413b6a74ff64a4ac0fe7 @bedeabza committed Sep 13, 2012
Showing with 15 additions and 11 deletions.
  1. +15 −11 library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
View
26 library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
@@ -66,22 +66,26 @@ public function onLoadModulesPost(Event $e)
$moduleManager = $e->getTarget();
$events = $moduleManager->getEventManager()->getSharedManager();
- // Shared instance for module manager
- $events->attach('Zend\Mvc\Application', 'bootstrap', function ($e) use ($moduleManager) {
- $moduleClassName = get_class($moduleManager);
- $application = $e->getApplication();
- $services = $application->getServiceManager();
- if (!$services->has($moduleClassName)) {
- $services->setService($moduleClassName, $moduleManager);
- }
- }, 1000);
+ if(false !== $events){
+ // Shared instance for module manager
+ $events->attach('Zend\Mvc\Application', 'bootstrap', function ($e) use ($moduleManager) {
+ $moduleClassName = get_class($moduleManager);
+ $application = $e->getApplication();
+ $services = $application->getServiceManager();
+ if (!$services->has($moduleClassName)) {
+ $services->setService($moduleClassName, $moduleManager);
+ }
+ }, 1000);
+ }
if (0 === count($this->modules)) {
return;
}
- // Attach to the bootstrap event if there are modules we need to process
- $events->attach('Zend\Mvc\Application', 'bootstrap', array($this, 'onBootstrap'), 1000);
+ if(false !== $events){
+ // Attach to the bootstrap event if there are modules we need to process
+ $events->attach('Zend\Mvc\Application', 'bootstrap', array($this, 'onBootstrap'), 1000);
+ }
}
/**

0 comments on commit 452d580

Please sign in to comment.