Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:15:41 AM (11 years ago)
Author:
boonebgorges
Message:

Don't trim whitespace from $meta_value param in _delete_meta() functions

The $meta_value parameter of BP's delete_meta() functions allows developers to
limit deletion to rows that match both the $meta_key *and* the specified
$meta_value. However, most of BP's delete_meta() functions have always had a
quirk whereby the $meta_value was run through trim() before matching against
the values in the database. This had the unacceptable side effect that passing
a $meta_value of ' foo ' would delete rows with the value 'foo', but *not*
the value ' foo '!

This changeset reverses the behavior, and modifies the relevant unit tests.

See #5399

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/xprofile/functions.php

    r8129 r8130  
    201201     * @group xprofilemeta
    202202     * @group bp_xprofile_delete_meta
     203     * @ticket BP5399
    203204     */
    204205    public function test_bp_xprofile_delete_meta_trim_meta_value() {
     
    207208        $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
    208209
    209         $this->assertTrue( bp_xprofile_delete_meta( $g, 'group', 'foo', ' bar  ' ) );
    210         $this->assertEquals( '', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
     210        bp_xprofile_delete_meta( $g, 'group', 'foo', ' bar  ' );
     211        $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
    211212    }
    212213
Note: See TracChangeset for help on using the changeset viewer.