[buddypress-trac] [BuddyPress Trac] #8694: WordPress 6.0 change in WP_User_Query causes BuddyPress PHP Notice and maybe other side effects.

buddypress-trac noreply at wordpress.org
Wed May 4 03:04:05 UTC 2022


#8694: WordPress 6.0 change in WP_User_Query causes BuddyPress PHP Notice and
maybe other side effects.
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Members       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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:
  - https://core.trac.wordpress.org/changeset/53255
  - https://core.trac.wordpress.org/changeset/53327

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8694>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list