Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:15:41 AM (10 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/blogs/functions.php

    r8129 r8130  
    2929     * @group blogmeta
    3030     * @group bp_blogs_delete_blogmeta
     31     * @ticket BP5399
    3132     */
    3233    public function test_bp_blogs_delete_blogmeta_trim_meta_value() {
    3334        $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
    3435        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    35         $this->assertTrue( bp_blogs_delete_blogmeta( 1, 'foo', '   bar  ') );
    36         $this->assertSame( '', bp_blogs_get_blogmeta( 1, 'foo' ) );
     36        bp_blogs_delete_blogmeta( 1, 'foo', '   bar  ' );
     37        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    3738    }
    3839
Note: See TracChangeset for help on using the changeset viewer.