Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8494 closed defect (bug) (fixed)

PHP error with WP Biography xProfile field type sanitization callback

Reported by: imath Owned by: imath
Priority: normal Milestone: 9.0.0
Component: Extended Profile Version: 8.0.0
Severity: normal Keywords: has-patch
Cc:

Description

When this field is empty, BP_XProfile_Field_Type_WordPress::sanitize_for_db() is generating an error trying to trim an array.

I need to understand why it's not a string as expected 🤔

Attachments (1)

8494.patch (639 bytes ) - added by imath 5 years ago.

Download all attachments as: .zip

Change History (5)

@imath
5 years ago

#1 @imath
5 years ago

  • Keywords needs-testing removed

Ok, I got it: xprofile_set_field_data() is using an array for fields accepting a null value (used for checkboxes, multiselect). That's why.

#2 @imath
5 years ago

In 12977:

Make sure saving empty WP xProfile fields does generate an error

WP xProfile field types are allowing their values to be empty. In such a case the xprofile_set_field_data() is using an array as the value to be saved. This is done to avoid the value of certain types of fields (checkboxes, multiselects) to be overwritten by the default value on next edit.

For WP xProfile field types, we simply need to return an empty string in this case.

See #8494 (branch 8.0)

#3 @imath
5 years ago

  • Owner set to imath
  • Resolutionfixed
  • Status newclosed

In 12978:

Make sure saving empty WP xProfile fields does generate an error

WP xProfile field types are allowing their values to be empty. In such a case the xprofile_set_field_data() is using an array as the value to be saved. This is done to avoid the value of certain types of fields (checkboxes, multiselects) to be overwritten by the default value on next edit.

For WP xProfile field types, we simply need to return an empty string in this case.

Fixes #8494 (trunk)

#4 @imath
5 years ago

  • Milestone 8.1.09.0.0

Ticket retargeted after milestone deleted

Note: See TracTickets for help on using tickets.