Skip to:
Content

BuddyPress.org

Opened 2 years ago

Closed 23 months 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's profile 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)

#1 @dd32
2 years ago

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.

#2 @imath
2 years ago

  • Milestone changed from Awaiting Review to 10.3.0

Thanks a lot for the report here and upstream @dd32 😍. Let’s keep an eye on it 👍.

#3 @pbearne
2 years ago

I have update a patch for core

#4 @imath
2 years ago

Thanks a lot @pbearne 💪. I'll test it with BuddyPress asap.

#5 @imath
2 years ago

I confirm it's fixing the notice errors 👍

#6 @dd32
23 months ago

  • Milestone 10.3.0 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.