diff --git a/core/includes/module.inc b/core/includes/module.inc
index aa9eaf5..368da6f 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -20,9 +20,20 @@ function module_load_all($bootstrap = FALSE) {
   static $has_run = FALSE;
 
   if (isset($bootstrap)) {
+    // Retrieve the Drupal ClassLoader to add all the module namespaces.
+    $loader = drupal_classloader();
+
     foreach (module_list(TRUE, $bootstrap) as $module) {
       drupal_load('module', $module);
+
+      // Register the module's namespace to the module's lib path.
+      $path = drupal_get_filename('module', $module);
+      $loader->add("Drupal\\$module", dirname($path) . '/lib/');
     }
+
+    // Now that all module paths are added, register the namespaces.
+    $loader->register();
+
     // $has_run will be TRUE if $bootstrap is FALSE.
     $has_run = !$bootstrap;
   }
