ZF-6803: Zend_Application Default Module Bootstrap is Skipped


I am sure I have seen this mentioned but can't find it now. In the modules resource the default module can't have a it's own bootstrap.

I would of thought this should be changed to allow any module to be used as a default, which may in turn have it's own bootstrap file.

Is the idea that the application bootstrap should extend your default modules bootstrap?


What more worst: because "default" is skipped no Resource Autoloader is created. For consistance this skipping of "default" should be undone.

I don't know how to submit a proper patch, but maybe someone who does will find this useful. This 'patch' should resolve the issue.

I also think it would be usefull to have a default module bootstrap

its not really usefull, cause you can also put the init functions in the application bootstrap, but i think its easier to understand, if i have to explain bootstrapping to somebody who doesnt know zf, i simply tell him each module has its own bootstrap and the application itself has a (main)-bootstrap

i dont know why it was done like it is, there is probably a good reason, but if you dont want to change the behavior to allow a default bootstap, then at least add the possibility to add a parameter in the config file which lets you choose i want a default bootsrap or i dont want, if you want one the default module bootsrap should be loaded

This patch should be incorporated into the latest ZF release. No resource autoloader is created which is a pain.

This patch is naive.

The reason that the default module is skipped is because the documented use case -- particularly how we setup an application in Zend_Tool -- is that the default module is directly beneath application/ and contains the application bootstrap. If we then allow loading the default module's bootstrap... we get into a recursive loop. This is precisely what will happen if we apply the attached patch -- I know, because that logic is there because the recursive loop occurred while I was developing the functionality originally, and the code removed by the patch recreates the original code.

However, I think I may be able to come up with a working patch by checking any given bootstrap against the one registered with the resource, and will be attempting it shortly.

Fixed in trunk and 1.9 release branch.

Your probably right, i'm a naive (script kiddy) ;) but i'm happy to help a little bit, by opening new bug reprts or replying to existing ones, even if my "naivity" doesnt made it impossible for me to provide a good fix ;)

I applied the fix to my test application and it worked very well!

My websites have this structure:

  • application --bootstrap.php //application bootstrap, setups cache, db profiler ... --config ---application.xml --layouts --caches --logs --modules ---moduleA ----bootsrap.php // module bootsrap, setups translations, routes, loads module config file ... ---configs ----translations.tmx ----config.xml ----routes.xml ---moduleB ----bootsrap.php ---moduleC ----bootsrap.php

Now if i switch the default module, from A to B, the only change i have to do is to change the row resources.frontcontroller.defaultmodule in the application.xml

As i said before, if i have to explain how my app works to somebody new that all module has its own bootsrap and dont need to tell him that the default module does not

Thx a lot for solving the problem you made me (and probably others) really happy ;)

I'm sorry if I may have caused offense with the word "naive". The intent behind my usage was based on the definition "uninstructed: lacking information or instruction" -- basically, it was a patch that did not take into account all the existing use cases. However, this report, and others I've heard, made this a pretty big priority to accommodate, and I'm glad the solution works for you!

No problem. I wasnt offended, but it was some sort of displeasure. I know lots of devs that dont want to ask stuff in forums or mailinglists because they are afraid somebody could call them dumb. Thats why i prefer if people are carefull about the words they use. I know you didnt want to harm anybody and i know you always answer to questions even if they come from naive devs ;)

One year ago i started working with ZF, since then i used it for three websites, unfortunatly i did have a lot of time to really learn how it works i simply used it, last month i tried to start a proposal for a zend_google_wave component but really fast i noticed that my knowledge was not good enough, i was also afraid people could laugh at me because my proposal is not as good as theirs. As soon as i'm able to improve my knowledge i will perhaps finish it and then publish it, i just hope people wont laugh ;)

Enough of topic, sorry for consuming your precious time, i'm a huge ZF, Zend and of course Matthew Weier O'Phinney fan ;)

Hi. I am doing a similar thing and hoped you could post the project skeleton (maybe a zip or inline code) that you have described above (or at least the config.ini (or .xml), application bootstrap and each module bootstrap. This issue is now a few months old, but the ZF documentation has not made it much easier. Thanks.