Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.192
diff -u -p -r1.192 module.inc
--- includes/module.inc	9 May 2010 13:49:33 -0000	1.192
+++ includes/module.inc	24 Jun 2010 13:14:17 -0000
@@ -585,6 +585,9 @@ function module_implements($hook, $sort 
   }
 
   if (!isset($implementations[$hook])) {
+    // The hook is not cached, so ensure that whether or not it has
+    // implementations, that the cache is updated at the end of the request.
+    $implementations['#write_cache'] = TRUE;
     $hook_info = module_hook_info();
     $implementations[$hook] = array();
     $list = module_list(FALSE, FALSE, $sort);
@@ -592,8 +595,6 @@ function module_implements($hook, $sort 
       $include_file = isset($hook_info[$hook]['group']) && module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']);
       if (module_hook($module, $hook)) {
         $implementations[$hook][$module] = $include_file ? $hook_info[$hook]['group'] : FALSE;
-        // We added something to the cache, so write it when we are done.
-        $implementations['#write_cache'] = TRUE;
       }
     }
     // Allow modules to change the weight of specific implementations but avoid
