Browse Source

ZF-6545: prevent duplicate bootstrapping of resources from module bootstraps; ensure front controller still present in module bootstrap

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15552 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 years ago
parent
commit
58b75ce7c8

+ 6 - 1
library/Zend/Application/Module/Bootstrap.php

@@ -51,7 +51,7 @@ abstract class Zend_Application_Module_Bootstrap
      */
     public function __construct($application)
     {
-        parent::__construct($application);
+        $this->setApplication($application);
 
         // Use same plugin loader as parent bootstrap
         if ($application instanceof Zend_Application_Bootstrap_ResourceBootstrapper) {
@@ -71,6 +71,11 @@ abstract class Zend_Application_Module_Bootstrap
         }
         $this->initResourceLoader();
 
+        // ZF-6545: ensure front controller resource is loaded
+        if (!$this->hasPluginResource('FrontController')) {
+            $this->registerPluginResource('FrontController');
+        }
+
         // ZF-6545: prevent recursive registration of modules
         if ($this->hasPluginResource('Modules')) {
             $this->unregisterPluginResource('Modules');

+ 6 - 1
tests/Zend/Application/Module/BootstrapTest.php

@@ -149,7 +149,12 @@ class Zend_Application_Module_BootstrapTest extends PHPUnit_Framework_TestCase
             'bootstrap' => array(
                 'path'  => dirname(__FILE__) . '/../_files/ZfAppBootstrap.php',
                 'class' => 'ZfAppBootstrap',
-            )
+            ),
+            'ZfModule' => array(
+                'resources' => array(
+                    'FrontController' => array(),
+                ),
+            ),
         ));
         $appBootstrap = $this->application->getBootstrap();
         $appBootstrap->bootstrap('FrontController');