diff --git a/includes/common.inc b/includes/common.inc
index cd30145..e641429 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5210,6 +5210,11 @@ function _drupal_bootstrap_full() {
   unicode_check();
   // Undo magic quotes
   fix_gpc_magic();
+  // Reset drupal_alter() and module_implements() static caches as these
+  // include implementations for vital modules only when called early on
+  // in the bootstrap.
+  drupal_static_reset('drupal_alter');
+  drupal_static_reset('module_implements');
   // Load all enabled modules
   module_load_all();
   // Make sure all stream wrappers are registered.
diff --git a/includes/module.inc b/includes/module.inc
index 494924f..d429ab8 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -885,6 +885,9 @@ function module_invoke($module, $hook) {
  * @see drupal_alter()
  */
 function module_invoke_all($hook) {
+  if (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL && (!defined('MAINTENANCE_MODE') || (MAINTENANCE_MODE != 'update' && MAINTENANCE_MODE != 'install'))) {
+    trigger_error('module_invoke_all() should not be called before full bootstrap.', E_USER_WARNING);
+  }
   $args = func_get_args();
   // Remove $hook from the arguments.
   unset($args[0]);
