Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.320 diff -u -r1.320 bootstrap.inc --- includes/bootstrap.inc 2 Nov 2009 03:46:43 -0000 1.320 +++ includes/bootstrap.inc 2 Nov 2009 21:49:38 -0000 @@ -2032,9 +2032,13 @@ // Reset a single value, or all values. if ($reset) { if (isset($name)) { - unset($data[$name]); + $data[$name] = NULL; // Set data to NULL + unset($data[$name]); // Remove reference } else { + foreach (array_keys($data) as $name) { + $data[$name] = NULL; // Set data to NULL + } $data = array(); } // We must return a reference to a variable. Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.164 diff -u -r1.164 module.inc --- includes/module.inc 1 Nov 2009 22:10:07 -0000 1.164 +++ includes/module.inc 2 Nov 2009 21:49:38 -0000 @@ -367,7 +367,13 @@ * @see module_implements_write_cache(). */ function module_implements($hook, $sort = FALSE, $reset = FALSE) { - $implementations = &drupal_static(__FUNCTION__, array()); + // Use a static variable to store a reference to drupal_static()'s data so + // drupal_static() only needs to be called once. + static $cache = array(); + if (!isset($cache['implementations'])) { + $cache['implementations'] = &drupal_static(__FUNCTION__, array()); + } + $implementations = &$cache['implementations']; // We maintain a persistent cache of hook implementations in addition to the // static cache to avoid looping through every module and every hook on each