Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.320 diff -u -p -r1.320 bootstrap.inc --- includes/bootstrap.inc 2 Nov 2009 03:46:43 -0000 1.320 +++ includes/bootstrap.inc 5 Nov 2009 03:32:59 -0000 @@ -2032,9 +2032,13 @@ function &drupal_static($name, $default_ // 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/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1040 diff -u -p -r1.1040 common.inc --- includes/common.inc 3 Nov 2009 06:47:22 -0000 1.1040 +++ includes/common.inc 5 Nov 2009 03:32:59 -0000 @@ -2275,7 +2275,14 @@ function format_interval($timestamp, $gr * A translated date string in the requested format. */ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { - $timezones = &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()); + } + $timezones = &$drupal_static[__FUNCTION__]; + if (!isset($timezone)) { global $user; if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) { @@ -2512,7 +2519,13 @@ function url($path = NULL, array $option } 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 @@ -6181,8 +6194,13 @@ function drupal_check_incompatibility($v * to return an array with info about all types. */ function entity_get_info($entity_type = NULL) { - // We statically cache the information returned by hook_entity_info(). - $entity_info = &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()); + } + $entity_info = &$drupal_static[__FUNCTION__]; if (empty($entity_info)) { if ($cache = cache_get('entity_info')) { Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.164 diff -u -p -r1.164 module.inc --- includes/module.inc 1 Nov 2009 22:10:07 -0000 1.164 +++ includes/module.inc 5 Nov 2009 03:32:59 -0000 @@ -367,7 +367,13 @@ function module_hook($module, $hook) { * @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 Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.47 diff -u -p -r1.47 path.inc --- includes/path.inc 24 Oct 2009 05:13:43 -0000 1.47 +++ includes/path.inc 5 Nov 2009 03:32:59 -0000 @@ -45,14 +45,20 @@ function drupal_path_initialize() { */ 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 @@ function drupal_get_normal_path($path, $ * 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']; @@ -310,7 +322,13 @@ function drupal_set_title($title = NULL, * Boolean value: TRUE if the current page is the front page; FALSE if otherwise. */ function drupal_is_front_page() { - $is_front_page = &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__); + } + $is_front_page = &$drupal_static[__FUNCTION__]; if (!isset($is_front_page)) { // As drupal_path_initialize updates $_GET['q'] with the 'site_frontpage' path, Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1075 diff -u -p -r1.1075 user.module --- modules/user/user.module 1 Nov 2009 21:26:44 -0000 1.1075 +++ modules/user/user.module 5 Nov 2009 03:33:02 -0000 @@ -673,7 +673,13 @@ function user_role_permissions($roles = */ function user_access($string, $account = NULL) { global $user; - $perm = &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()); + } + $perm = &$drupal_static[__FUNCTION__]; if (!isset($account)) { $account = $user;