API page: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...
API page: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...

hook_boot and hook_init are documented as being equivilent except for caching, but theme initialisation (menu_set_custom_theme and drupal_theme_initialize) is performed after hook_init, but after hook_boot.

This important because it means you can't see what theme you're running when in hook_boot, and you can't do anything that might change the theme in hook_init.

Files: 
CommentFileSizeAuthor
#4 drupal-init_and_boot_docx-1513580-4.patch1.11 KBmatt2000
PASSED: [[SimpleTest]]: [MySQL] 36,515 pass(es).
[ View ]

Comments

Version:7.x-dev» 8.x-dev
Issue tags:+needs backport to D7

I don't see where the documentation says they are equivalent except for caching? But sure, probably they should both say something about whether or not the theme system has been initialized.

Hmm... I see that hook_init() is invoked from _drupal_bootstrap_full(), so I can confirm that the theme system is initialized before it is invoked. But I'm not sure where hook_boot() is invoked. Someone needs to figure that out...

Sorry, it doesn't explictly say that they are identical, but the documentation is the same for both functions.

I'm not sure how the version field is used, but this applies to 7.x as well as 8.x.

Title:hook_init and hook_boot documentation ignores theme initialisationhook_init and hook_boot documentation should say whether themes are initialized
Issue tags:+Novice

Versions: our policy is that we fix it first in Drupal 8, then backport to Drupal 7, hence the "needs backport" tag, and setting the version to Drupal 8.

Doc: The doc for the two pages is not really identical. The hook_init() doc specifically says it is for non-cached pages only, for instance, and it says it runs after modules are loaded, while hook_boot() says it goes before most modules and includes are loaded.

So I think all we can really do here is to add a note to hook_init() that also says the theme system is initialized, and maybe add something to hook_boot() that says the theme system is not initialized.

Status:Active» Needs review
StatusFileSize
new1.11 KB
PASSED: [[SimpleTest]]: [MySQL] 36,515 pass(es).
[ View ]

How's this?

Status:Needs review» Reviewed & tested by the community

That looks fine to me. Thanks! I'll get it committed soon.

Status:Reviewed & tested by the community» Fixed

Thanks! Committed to both 7.x and 8.x.

Automatically closed -- issue fixed for 2 weeks with no activity.