WordPress.org

Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #15458, comment 42


Ignore:
Timestamp:
08/07/11 02:10:11 (3 years ago)
Author:
ryan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15458, comment 42

    v2 v3  
    11{{{ 
    2 $this->caps = $this->data->{$this->cap_key}; 
     2$this->caps = &$this->data->{$this->cap_key}; 
    33if ( ! is_array( $this->caps ) ) 
    44        $this->caps = array(); 
    55}}} 
    66 
    7 Those lines in WP_User::_init_caps() are somehow causing cache pollution.  wp_cache_get($id, 'users'), as done in get_userdata(), will sometimes return an object with the wp_xxx_capabilities property set ( where xxx is the current blog id).  The value is an empty array.  This confuses get_blogs_of_user(), which sees that the property is set and mistakenly thinks the user belongs to the current blog.  Since the cache clones objects on set and get this is rather unexpected. 
     7Those lines in WP_User::_init_caps() are somehow causing cache pollution.  wp_cache_get($id, 'users'), as done in get_userdata(), will sometimes return an object with the wp_xxx_capabilities property set ( where xxx is the current blog id).  The value is an empty array.  This confuses get_blogs_of_user(), which sees that the property is set and mistakenly thinks the user belongs to the current blog.  Since the cache clones objects on set and get this is rather unexpected.  Removing the ref assignment avoids the problem.