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..24e5dd7 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -833,6 +833,11 @@ function module_hook_info() {
  * @see module_implements()
  */
 function module_implements_write_cache() {
+  // The list of implementations includes vital modules only before full
+  // bootstrap, so do not write cache if we are not fully bootstrapped yet.
+  if (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL) {
+    return;
+  }
   $implementations = &drupal_static('module_implements');
   if (isset($implementations['#write_cache'])) {
     unset($implementations['#write_cache']);
diff --git a/modules/simpletest/simpletest.info b/modules/simpletest/simpletest.info
index 7b139ba..1aec619 100644
--- a/modules/simpletest/simpletest.info
+++ b/modules/simpletest/simpletest.info
@@ -11,6 +11,7 @@ configure = admin/config/development/testing/settings
 files[] = tests/actions.test
 files[] = tests/ajax.test
 files[] = tests/batch.test
+files[] = tests/boot.test
 files[] = tests/bootstrap.test
 files[] = tests/cache.test
 files[] = tests/common.test
diff --git a/modules/simpletest/tests/boot.test b/modules/simpletest/tests/boot.test
new file mode 100644
index 0000000..d910b18
--- /dev/null
+++ b/modules/simpletest/tests/boot.test
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Perform early bootstrap tests.
+ */
+class EarlyBootstrapTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name'  => 'Early bootstrap test',
+      'description'  => 'Confirm that calling module_implements() during early bootstrap does not pollute the module_implements() cache.',
+      'group' => 'System',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('boot_test_1', 'boot_test_2');
+  }
+
+  public function testHookBoot() {
+    $this->doTestHookBoot('');
+    $this->doTestHookBoot('early_exit');
+  }
+
+  protected function doTestHookBoot($path) {
+    // Empty the module_implements() caches.
+    module_implements(NULL, FALSE, TRUE);
+    // Do a request to the front page, which will call module_implements()
+    // during hook_boot().
+    $this->drupalGet($path);
+    // Reset the static cache so we get data from the database cache.
+    drupal_static_reset();
+    // Make sure we get a full list of all modules implementing hook_help().
+    $modules = module_implements('help');
+    $this->assertTrue(in_array('boot_test_2', $modules));
+  }
+
+}
diff --git a/modules/simpletest/tests/boot_test_1.module b/modules/simpletest/tests/boot_test_1.module
new file mode 100644
index 0000000..eab5dcc
--- /dev/null
+++ b/modules/simpletest/tests/boot_test_1.module
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Tests calling module_implements during hook_boot() invocation.
+ */
+
+/**
+ * Implements hook_boot().
+ */
+function boot_test_1_boot() {
+  // Calling module_implements during hook_boot() will return vital modules
+  // only.
+  module_implements('help');
+  // Define a special path to test that the static cache isn't written away
+  // if we exit before having completed the bootstrap.
+  if ($_GET['q'] == 'early_exit') {
+    module_implements_write_cache();
+    exit();
+  }
+}
diff --git a/modules/simpletest/tests/boot_test_2.module b/modules/simpletest/tests/boot_test_2.module
new file mode 100644
index 0000000..c3ab8d6
--- /dev/null
+++ b/modules/simpletest/tests/boot_test_2.module
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * @file
+ * Defines a hook_help() implementation in a non-"bootstrap" module.
+ */
+
+/**
+ * Implements hook_help().
+ */
+function boot_test_2_help($path, $arg) {
+  // Empty hook.
+}
