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

buddypress-trac noreply at wordpress.org
Tue Apr 9 14:20:48 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:  low                                  |   Milestone:  14.0.0
Component:  REST API                             |     Version:  12.4.0
 Severity:  minor                                |  Resolution:
 Keywords:  has-unit-tests needs-testing-info    |
  has-dev-note                                   |
-------------------------------------------------+-------------------------

Comment (by espellcaste):

 Thanks! That helped! Confirmed that `unserialize` doesn't work well when
 there is quoted strings inside it.

 The issue is coming from our `bp_unserialize_profile_field`
 [https://github.com/buddypress/buddypress/blob/1324819e975bc948ce67d1a569b52ffba5e98974/src
 /bp-xprofile/bp-xprofile-template.php#L983 function].

 This does not only happen when updating a field, but by seeing a field
 too.

 The root of the issue seems to be
 [https://github.com/buddypress/buddypress/blob/62a0973cff4b67c17ff4aab19a31490d38b773e4/src
 /bp-xprofile/classes/class-bp-xprofile-profiledata.php#L106 this line].

 It is removing the slash of the quoted string and the PHP `unserialize`
 function can't handle the new string properly.

 @imath I'd love your take on a possible solution here.

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


More information about the buddypress-trac mailing list