Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
5 Oct 2007 at 12:50 UTC
Updated:
12 Nov 2007 at 22:42 UTC
Jump to comment: Most recent file
Because the $phase_index++ is after the _drupal_bootstrap call, if a hook_boot module calls back drupal_bootstrap (to boot forward to _PATH) it will break. Also the code can be simplified a tad bit.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | bootstrap-reentrant.patch | 980 bytes | bjaspan |
| bootstrap_29.patch | 994 bytes | chx |
Comments
Comment #1
dries commentedThis looks OK. Committed.
Comment #2
(not verified) commentedComment #3
bjaspan commentedThis is a pretty serious bug and it exists in D5, too. I've attached a D5 patch that fixes it slightly differently than the D6 patch. I'll adapt the D6 patch if that is what will get committed.
For the record, here is one example (the one I encountered) that triggers buggy behavior:
drupal_bootstrap() can be called more than once including from within other bootstrap steps (e.g. statistics_exit() called during LATE_PAGE_CACHE calls drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH)). As written, drupal_bootstrap() *always* shifts the next phase off the list and performs it.
This is wrong. Consider the scenario where you have two modules, A and B, both of which do what statistics.module does, and the page cache enabled:
1. index.php calls bootstrap(FULL).
2. bootstrap(FULL) goes as far as LATE_PAGE_CACHE. At this point, $phases still contains (PATH, FULL).
3. LATE_PAGE_CACHE finds a page cache hit, calls hook_boot(), outputs the cached page, and calls hook_exit().
4. a_exit() calls bootstrap(PATH).
5. bootstrap(PATH) shifts $phases, gets PATH, calls it, and returns.
6. b_exit() calls bootstrap(PATH).
5. bootstrap(PATH) shifts $phases, gets FULL, calls it (generating a "cannot set headers, output already started" error) and returns. Buzzz.
Comment #4
drummCommitted to 5.x.
Comment #5
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.