Skip to:
Content

BuddyPress.org

Opened 6 weeks ago

Last modified 6 weeks ago

#9290 new defect (bug)

ERROR THROWN "NEW TOP 10!"

Reported by: potcus's profile potcus Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch needs-testing
Cc: rollybueno

Description

Error Details
=============
An error of type E_ERROR was caused in line 130 of the file .../wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-profiledata.php. Error message: Uncaught Error: Object of class WP_Error could not be converted to string in ...wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-profiledata.php:130
Stack trace:
#0 ...wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-profiledata.php(246): BP_XProfile_ProfileData->exists()
#1 ...wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php(526): BP_XProfile_ProfileData->save()
#2 .../wp-content/plugins/buddypress/bp-members/bp-members-functions.php(2116): xprofile_set_field_data()
#3 .../wp-content/plugins/buddypress/bp-members/classes/class-bp-signup.php(949): bp_core_activate_signup()
#4 .../wp-content/plugins/buddypress/bp-members/classes/class-bp-members-admin.php(1976): BP_Signup::activate()
#5 .../wp-includes/class-wp-hook.php(324): BP_Members_Admin->signups_admin_load()
#6 .../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#7 .../wp-includes/plugin.php(517): WP_Hook->do_action()
#8 .../wp-admin/admin.php(238): do_action()
#9 .../wp-admin/users.php(11): require_once('...')
#10 {main}

thrown

Change History (2)

This ticket was mentioned in PR #412 on buddypress/buddypress by @rollybueno.


6 weeks ago
#1

  • Keywords has-patch added

The exists() method was attempting to convert a WP_Error object to a string when
checking for profile data existence. This fix:

  1. Initializes $retval as false by default
  2. Properly handles WP_Error and empty results from database queries
  3. Ensures consistent boolean return value throughout the method
  4. Removes unnecessary boolean casting in apply_filters_ref_array

This prevents the "Object of class WP_Error could not be converted to string" error
while maintaining the expected boolean return value of the exists() method.

Trac ticket: https://buddypress.trac.wordpress.org/ticket/9290

#2 @rollybueno
6 weeks ago

  • Cc rollybueno added
  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.