WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#16836 closed defect (bug) (fixed)

get_blogs_of_user does not initializes each blog item as stdClass

Reported by: erickrdch Owned by:
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.1
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

I am developing a multisite plugin and found that get_blogs_of_user is not initializing each of the blog objects as a stdClass inside the blogs array.

Current code in wp-includes/user.php (Lines 656, 657):

$blogs = array();
$blogs[ $blog_id ]->userblog_id = $blog_id; // Cannot start adding elements to an object that is not yet defined.

Fix:

$blogs = array();
$blogs[ $blog_id ] = new stdClass();
$blogs[ $blog_id ]->userblog_id = $blog_id;

Same happens in lines 702, 706.

Attached is a patch file.

Attachments (1)

user.patch (937 bytes) - added by erickrdch 10 years ago.

Download all attachments as: .zip

Change History (3)

@erickrdch
10 years ago

#1 @scribu
10 years ago

  • Component changed from Users to Multisite

#2 @PeteMall
9 years ago

  • Milestone changed from Awaiting Review to 3.3
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [18560].

Note: See TracTickets for help on using tickets.