Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1038 diff -u -r1.1038 common.inc --- includes/common.inc 2 Nov 2009 03:46:43 -0000 1.1038 +++ includes/common.inc 2 Nov 2009 22:16:50 -0000 @@ -2457,7 +2457,13 @@ } global $base_url, $base_secure_url, $base_insecure_url; - $script = &drupal_static(__FUNCTION__); + // Use a static variable to store a reference to drupal_static()'s data so + // drupal_static() only needs to be called once. + static $drupal_static = array(); + if (!isset($drupal_static[__FUNCTION__])) { + $drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__); + } + $script = &$drupal_static[__FUNCTION__]; if (!isset($script)) { // On some web servers, such as IIS, we can't omit "index.php". So, we 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 22:16:47 -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/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.47 diff -u -r1.47 path.inc --- includes/path.inc 24 Oct 2009 05:13:43 -0000 1.47 +++ includes/path.inc 2 Nov 2009 22:16:50 -0000 @@ -45,14 +45,20 @@ */ function drupal_lookup_path($action, $path = '', $path_language = '') { global $language; - $cache = &drupal_static(__FUNCTION__, array( - 'map' => array(), - 'no_source' => array(), - 'whitelist' => NULL, - 'system_paths' => array(), - 'no_aliases' => array(), - 'first_call' => TRUE, - )); + // Use a static variable to store a reference to drupal_static()'s data so + // drupal_static() only needs to be called once. + static $drupal_static = array(); + if (!isset($drupal_static[__FUNCTION__])) { + $drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, array( + 'map' => array(), + 'no_source' => array(), + 'whitelist' => NULL, + 'system_paths' => array(), + 'no_aliases' => array(), + 'first_call' => TRUE, + )); + } + $cache = &$drupal_static[__FUNCTION__]; // Retrieve the path alias whitelist. if (!isset($cache['whitelist'])) { @@ -245,7 +251,13 @@ * not found. */ function arg($index = NULL, $path = NULL) { - $arguments = &drupal_static(__FUNCTION__); + // Use a static variable to store a reference to drupal_static()'s data so + // drupal_static() only needs to be called once. + static $drupal_static = array(); + if (!isset($drupal_static[__FUNCTION__])) { + $drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__); + } + $arguments = &$drupal_static[__FUNCTION__]; if (!isset($path)) { $path = $_GET['q']; 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 22:16:50 -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 $drupal_static = array(); + if (!isset($drupal_static[__FUNCTION__])) { + $drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, array()); + } + $implementations = &$drupal_static[__FUNCTION__]; // 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