Opened 3 years ago
Closed 3 years ago
#8694 closed defect (bug) (reported-upstream)
WordPress 6.0 change in WP_User_Query causes BuddyPress PHP Notice and maybe other side effects.
Reported by: | dd32 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Members | Keywords: | |
Cc: |
Description
This may be a regression in WordPress core, but it appears that BuddyPress is relying upon an invalid value to WP_User_Query.
E_NOTICE: Undefined property: stdClass::$user_status in wp-content/plugins/buddypress/bp-core/classes/class-bp-user-query.php:616 Undefined property: stdClass::$user_status Source: GET https://buddypress.org/members/dd32/
Code in question:
https://buddypress.trac.wordpress.org/browser/trunk/src/bp-core/classes/class-bp-user-query.php?marks=569-574,584-587,616#L563
In this case, $r[ $uid ]
is equal to this:
object(stdClass)[2416] public 'ID' => int 148148 public 'user_login' => string 'dd32' (length=4) public 'user_nicename' => string 'dd32' (length=4) public 'user_email' => string 'emailemail' (length=8) public 'user_url' => string '' (length=0) public 'user_registered' => string '2007-01-20 23:51:39' (length=19) public 'display_name' => string 'Dion Hulse' (length=10)
Although, the requested fields are correct as to what BuddyPress expected to query:
... 'fields' => array (size=12) 0 => string 'ID' (length=2) 1 => string 'user_login' (length=10) 2 => string 'user_pass' (length=9) 3 => string 'user_nicename' (length=13) 4 => string 'user_email' (length=10) 5 => string 'user_url' (length=8) 6 => string 'user_registered' (length=15) 7 => string 'user_activation_key' (length=19) 8 => string 'user_status' (length=11) 9 => string 'display_name' (length=12) 10 => string 'spam' (length=4) 11 => string 'deleted' (length=7) ....
This is because of these core commits, which now validate the fields
parameter is valid and expected:
Change History (6)
Note: See
TracTickets for help on using
tickets.
Upstream comment and re-opened ticket: https://core.trac.wordpress.org/ticket/53177#comment:31
It seems likely that this might be fixed in core, but raising it here as a FYI.