Opened 2 years ago

Closed 21 months ago

#16836 closed defect (bug) (fixed)

get_blogs_of_user does not initializes each blog item as stdClass

Reported by: erickrdch Owned by:
Priority: normal Milestone: 3.3
Component: Multisite Version: 3.1
Severity: normal Keywords: has-patch
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 2 years ago.

Download all attachments as: .zip

Change History (3)

  • Component changed from Users to Multisite
  • 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.