diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/user/user.module | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index e9e3849fa..41f83d945 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -719,9 +719,11 @@ function user_access($string, $account = NULL) { // 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__]; + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__); + } + $perm = &$drupal_static_fast['perm']; if (!isset($perm[$account->uid])) { $role_permissions = user_role_permissions($account->roles); |