ZF-11867: Module resource bootstraps default module when it's not supposed to

Issue Type: Bug Created: 2011-11-03T12:23:09.000+0000 Last Updated: 2011-11-11T09:58:52.000+0000 Status: Open Fix version(s): Reporter: Glen Ainscow (darkangel) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

  • Zend_Application_Resource

Related issues: Attachments: -


When I run my application using a cli.ini config file, which specifies the bootstrap options as:

bootstrap.path = APPLICATION_PATH "/CliBootstrap.php" bootstrap.class = "CliBootstrap"

Zend_Application_Resource_Modules#init() sets $bootstrapClass to "Bootstrap" (hard-coded) instead of getting this information from the config (or using $curBootstrapClass).

This results in the default module's Bootstrap being executed, when this has already been taken care of by the CliBootstrap.

One fix would be the following:

<pre class="highlight">
    //$bootstrapClass = 'Bootstrap';
    $bootstrapOptions = $this->getBootstrap()->getApplication()->getOption('bootstrap');
    $bootstrapClass = $bootstrapOptions['class']; // Or $curBootstrapClass.

Although the code in this method could probably be simplified. You could probably "continue:" if $module === $default.


Posted by Glen Ainscow (darkangel) on 2011-11-11T09:58:52.000+0000

Simple test project.

Run it using: php cli.php (from the scripts directory)

Expected output:

CLI Bootstrap Admin Bootstrap Blog Bootstrap

Actual output:

CLI Bootstrap App Bootstrap Admin Bootstrap Blog Bootstrap Admin Bootstrap Blog Bootstrap

... so not only is it bootstrapping the "App" bootstrap, it also appears to be bootstrapping modules twice (unless I messed something up when trying to keep the project as small as possible).

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.