[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 18:05:57 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 imath):

 Hi @espellcaste

 Here's my opinion about it!

 This very early `stripslashes()` is there since
 [https://buddypress.trac.wordpress.org/browser/branches/1.0/bp-xprofile
 /bp-xprofile-classes.php#L1024 1.0]. I checked history if this wasn't made
 on purpose to fix a bug.

 We have a lot of filters stripping slashes, so we are probably doing this
 twice. I'd see what happens if we remove this very early `stripslashes()`
 <-  probably the nicest solution ;)

 The other possibilities I see would be:
 - to do this before saving `is_string( $value ) ? wptexturize( $value ) :
 $value;` but I don't think we should do this.
 - to avoid doing this very early `stripslashes()`
 eg: `$this->value = is_serialized( $profiledata->value ) ?
 $profiledata->value : stripslashes( $profiledata->value );` <- probably
 the less risky!

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


More information about the buddypress-trac mailing list