ZF-6803: Zend_Application Default Module Bootstrap is Skipped

Issue Type: Improvement Created: 2009-05-25T23:58:30.000+0000 Last Updated: 2011-07-29T10:26:46.000+0000 Status: Resolved Fix version(s): - 1.9.2 (25/Aug/09)

Reporter: Simon Corless (sico) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

Related issues: - ZF-7158

Attachments: - zf-6803.patch


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?


Posted by Markus (rockaut) on 2009-06-29T07:53:22.000+0000

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

Posted by Nathan Bell (nathanpbell) on 2009-07-20T18:49:04.000+0000

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.

Posted by Weber Chris (chrisweb) on 2009-08-03T05:07:50.000+0000

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

Posted by Chris Jones (leeked) on 2009-08-18T12:40:03.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-08-21T09:39:25.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2009-08-21T12:50:31.000+0000

Fixed in trunk and 1.9 release branch.

Posted by Weber Chris (chrisweb) on 2009-08-25T01:12:02.000+0000

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 ;)

Posted by Matthew Weier O'Phinney (matthew) on 2009-08-25T04:47:23.000+0000

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!

Posted by Weber Chris (chrisweb) on 2009-08-25T09:03:33.000+0000

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 ;)

Posted by Jonathan Ingram (jing2148) on 2009-11-03T22:06:37.000+0000

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.

Have you found an issue?

See the Overview section for more details.


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

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