[wp-trac] [WordPress Trac] #16836: get_blogs_of_user does not initializes each blog item as stdClass
WordPress Trac
wp-trac at lists.automattic.com
Fri Mar 11 20:40:09 UTC 2011
#16836: get_blogs_of_user does not initializes each blog item as stdClass
--------------------------+-----------------------------
Reporter: erickrdch | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 3.1
Severity: normal | Keywords: has-patch
--------------------------+-----------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16836>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list