Changes between Version 2 and Version 3 of Ticket #15458, comment 42
- Timestamp:
- 08/07/2011 02:10:11 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #15458, comment 42
v2 v3 1 1 {{{ 2 $this->caps = $this->data->{$this->cap_key};2 $this->caps = &$this->data->{$this->cap_key}; 3 3 if ( ! is_array( $this->caps ) ) 4 4 $this->caps = array(); 5 5 }}} 6 6 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. 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. Removing the ref assignment avoids the problem.