Skip to:

Opened 9 years ago

Closed 9 years ago

#6354 closed defect (bug) (fixed)

`xprofile_insert_field()` `empty()` checks break booleans when updating existing field

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Extended Profile Keywords:


If you pass a 'field_id' to xprofile_insert_field() to update an existing field, it's not possible to set any true field to false. This is because all of the checks look like:

if ( ! empty( $r['foo'] ) ) {
    $this->foo = $r['foo'];

and false will not pass the test.

Change History (2)

#1 @boonebgorges
9 years ago

The same applies to any field that could optionally be set to a falsey value - as when you're setting 'field_order' to 0.

#2 @boonebgorges
9 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 9711:

Improve parameter sanitization in xprofile_insert_field().

The overzealous empty() checks meant that it was impossible to set certain
values on existing fields to falsey values.

Fixes #6354.

Note: See TracTickets for help on using tickets.