[buddypress-trac] [BuddyPress Trac] #9127: Critical error when updating xProfile fields through REST API using PHP 8+

buddypress-trac noreply at wordpress.org
Wed Mar 27 09:43:29 UTC 2024


#9127: Critical error when updating xProfile fields through REST API using PHP 8+
--------------------------+-----------------------------
 Reporter:  niftythree    |      Owner:  espellcaste
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Hello,

 When attempting to update an xProfile field through the REST API with
 value(s) that have an apostrophe in them, the REST API succeeds at making
 the change but then returns "There has been a critical error on this
 website." when using PHP 8 versions. Upon downgrading to PHP 7.4, the are
 no issues. We're using the latest WordPress and BuddyPress versions with
 the Legacy template.

 Output in error log:

 {{{
 PHP Fatal error:  Uncaught TypeError: implode(): Argument #2 ($array) must
 be of type ?array, bool given in /wp-content/plugins/buddypress/bp-
 xprofile/bp-xprofile-template.php:986
 Stack trace:
 #0 /wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-
 template.php(986): implode()
 #1 /wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-rest-
 xprofile-fields-endpoint.php(860): bp_unserialize_profile_field()
 #2 /wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-rest-
 xprofile-data-endpoint.php(437):
 BP_REST_XProfile_Fields_Endpoint->get_profile_field_rendered_value()
 #3 /wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-rest-
 xprofile-data-endpoint.php(253):
 BP_REST_XProfile_Data_Endpoint->prepare_item_for_response()
 #4 /wp-includes/rest-api/class-wp-rest-server.php(1193):
 BP_REST_XProfile_Data_Endpoint->update_item()
 #5 /wp-includes/rest-api/class-wp-rest-server.php(1041):
 WP_REST_Server->respond_to_request()
 #6 /wp-includes/rest-api/class-wp-rest-server.php(431):
 WP_REST_Server->dispatch()
 #7 /wp-includes/rest-api.php(424): WP_REST_Server->serve_request()
 #8 /wp-includes/class-wp-hook.php(324): rest_api_loaded()
 #9 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
 #10 /wp-includes/plugin.php(565): WP_Hook->do_action()
 #11 /wp-includes/class-wp.php(418): do_action_ref_array()
 #12 /wp-includes/class-wp.php(813): WP->parse_request()
 #13 /wp-includes/functions.php(1336): WP->main()
 #14 /wp-blog-header.php(16): wp()
 #15 /index.php(17): require('/website/12345.we...')
 #16 {main} thrown in /wp-content/plugins/buddypress/bp-xprofile/bp-
 xprofile-template.php on line 986
 }}}


 Also getting: PHP Warning:  Attempt to read property "display_name" on
 bool in /wp-content/plugins/buddypress/bp-messages/classes/class-bp-rest-
 messages-endpoint.php on line 879.

 Thanks.

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


More information about the buddypress-trac mailing list