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 07:10:57 -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 07:10:57 -0000
@@ -2275,7 +2275,10 @@ 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());
+  static $drupal_static = array(), $drupal_static_default = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $timezones = &$drupal_static[__FUNCTION__];
+
   if (!isset($timezone)) {
     global $user;
     if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) {
@@ -2512,7 +2515,9 @@ function url($path = NULL, array $option
   }
 
   global $base_url, $base_secure_url, $base_insecure_url;
-  $script = &drupal_static(__FUNCTION__);
+  static $drupal_static = array(), $drupal_static_default = NULL;
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $script = &$drupal_static[__FUNCTION__];
 
   if (!isset($script)) {
     // On some web servers, such as IIS, we can't omit "index.php". So, we
@@ -6181,8 +6186,9 @@ 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());
+  static $drupal_static = array(), $drupal_static_default = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $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 07:10:57 -0000
@@ -367,7 +367,9 @@ function module_hook($module, $hook) {
  * @see module_implements_write_cache().
  */
 function module_implements($hook, $sort = FALSE, $reset = FALSE) {
-  $implementations = &drupal_static(__FUNCTION__, array());
+  static $drupal_static = array(), $drupal_static_default = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $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 07:10:57 -0000
@@ -45,14 +45,16 @@ function drupal_path_initialize() {
  */
 function drupal_lookup_path($action, $path = '', $path_language = '') {
   global $language;
-  $cache = &drupal_static(__FUNCTION__, array(
+  static $drupal_static = array(), $drupal_static_default = array(
     'map' => array(),
     'no_source' => array(),
     'whitelist' => NULL,
     'system_paths' => array(),
     'no_aliases' => array(),
     'first_call' => TRUE,
-  ));
+  );
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $cache = &$drupal_static[__FUNCTION__];
 
   // Retrieve the path alias whitelist.
   if (!isset($cache['whitelist'])) {
@@ -245,7 +247,9 @@ function drupal_get_normal_path($path, $
  *   not found.
  */
 function arg($index = NULL, $path = NULL) {
-  $arguments = &drupal_static(__FUNCTION__);
+  static $drupal_static = array(), $drupal_static_default = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $arguments = &$drupal_static[__FUNCTION__];
 
   if (!isset($path)) {
     $path = $_GET['q'];
@@ -310,7 +314,9 @@ 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__);
+  static $drupal_static = array(), $drupal_static_default = NULL;
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $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 07:11:00 -0000
@@ -673,7 +673,9 @@ function user_role_permissions($roles = 
  */
 function user_access($string, $account = NULL) {
   global $user;
-  $perm = &drupal_static(__FUNCTION__, array());
+  static $drupal_static = array(), $drupal_static_default = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__, $drupal_static_default));
+  $perm = &$drupal_static[__FUNCTION__];
 
   if (!isset($account)) {
     $account = $user;
