Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.303
diff -u -9 -p -r1.303 bootstrap.inc
--- includes/bootstrap.inc	5 Sep 2009 13:05:30 -0000	1.303
+++ includes/bootstrap.inc	6 Sep 2009 00:18:32 -0000
@@ -1871,18 +1871,23 @@ function drupal_autoload_class($class) {
  *   The name of the resource, or NULL if either of the REGISTRY_* constants
  *   is passed in.
  * @return
  *   TRUE if the resource was found, FALSE if not.
  *   NULL if either of the REGISTRY_* constants is passed in as $type.
  */
 function _registry_check_code($type, $name = NULL) {
   static $lookup_cache, $cache_update_needed;
 
+  if ($type == 'class' && class_exists($name) ||
+      $type == 'interface' && interface_exists($name)) {
+    return TRUE;
+  }
+
   if (!isset($lookup_cache)) {
     $lookup_cache = array();
     if ($cache = cache_get('lookup_cache', 'cache_registry')) {
       $lookup_cache = $cache->data;
     }
   }
 
   // When we rebuild the registry, we need to reset this cache so
   // we don't keep lookups for resources that changed during the rebuild.
@@ -1895,26 +1900,26 @@ function _registry_check_code($type, $na
   // Called from drupal_page_footer, we write to permanent storage if there
   // changes to the lookup cache for this request.
   if ($type == REGISTRY_WRITE_LOOKUP_CACHE) {
     if ($cache_update_needed) {
       cache_set('lookup_cache', $lookup_cache, 'cache_registry');
     }
     return;
   }
 
-  // $type can be one of 'function', 'interface' or 'class', so we only need the
-  // first letter to keep the cache key unique.
+  // $type is either 'interface' or 'class', so we only need the first letter to
+  // keep the cache key unique.
   $cache_key = $type[0] . $name;
   if (isset($lookup_cache[$cache_key])) {
     if ($lookup_cache[$cache_key]) {
-      require_once DRUPAL_ROOT . '/' . $lookup_cache[$cache_key];
+      require DRUPAL_ROOT . '/' . $lookup_cache[$cache_key];
     }
-    return $lookup_cache[$cache_key];
+    return (bool)$lookup_cache[$cache_key];
   }
 
   // This function may get called when the default database is not active, but
   // there is no reason we'd ever want to not use the default database for
   // this query.
   $file = Database::getConnection('default', 'default')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array(
       ':name' => $name,
       ':type' => $type,
     ))
@@ -1922,19 +1927,19 @@ function _registry_check_code($type, $na
 
   // Flag that we've run a lookup query and need to update the cache.
   $cache_update_needed = TRUE;
 
   // Misses are valuable information worth caching, so cache even if
   // $file is FALSE.
   $lookup_cache[$cache_key] = $file;
 
   if ($file) {
-    require_once DRUPAL_ROOT . '/' . $file;
+    require DRUPAL_ROOT . '/' . $file;
     return TRUE;
   }
   else {
     return FALSE;
   }
 }
 
 /**
  * Rescan all enabled modules and rebuild the registry.
