Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1083
diff -u -p -r1.1083 user.module
--- modules/user/user.module	20 Nov 2009 06:12:45 -0000	1.1083
+++ modules/user/user.module	21 Nov 2009 00:15:45 -0000
@@ -679,10 +679,6 @@ function user_role_permissions($roles = 
  */
 function user_access($string, $account = NULL) {
   global $user;
-  // Use the advanced drupal_static() pattern, since this is called very often.
-  static $drupal_static = array();
-  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
-  $perm = &$drupal_static[__FUNCTION__];
 
   if (!isset($account)) {
     $account = $user;
@@ -695,6 +691,10 @@ function user_access($string, $account =
 
   // To reduce the number of SQL queries, we cache the user's permissions
   // in a static variable.
+  // Use the advanced drupal_static() pattern, since this is called very often.
+  static $drupal_static = array();
+  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
+  $perm = &$drupal_static[__FUNCTION__];
   if (!isset($perm[$account->uid])) {
     $role_permissions = user_role_permissions($account->roles);
 
