Skip to:
Content

BuddyPress.org


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

Don't improperly sanitize meta_key in _meta() functions

Many BP meta functions have always stripped certain characters from the
$meta_key parameter before performing their operations. This is a terrible idea
on a number of levels: it doesn't provide any feedback to the user, it silently
performs actions that are not equivalent to the ones intended by the user, and
it doesn't serve any real purpose (since any necessary sanitization happens at
the level of $wpdb). Moreover, it wasn't even applied consistently across all
functions. A truly delightful grab bag.

This changeset removes the sanitization, and updates the necessary unit tests
to reflect the change.

See #5399

File:
1 edited

Legend:

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

    r8109 r8129  
    186186     * @group xprofilemeta
    187187     * @group bp_xprofile_delete_meta
     188     * @ticket BP5399
    188189     */
    189190    public function test_bp_xprofile_delete_meta_illegal_characters() {
     
    193194
    194195        $krazy_key = ' f!@#$%^o *(){}o?+';
    195         $this->assertTrue( bp_xprofile_delete_meta( $g, 'group', 'foo' ) );
    196         $this->assertEquals( '', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
     196        bp_xprofile_delete_meta( $g, 'group', $krazy_key );
     197        $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
    197198    }
    198199
     
    378379     * @group xprofilemeta
    379380     * @group bp_xprofile_update_meta
     381     * @ticket BP5399
    380382     */
    381383    public function test_bp_xprofile_update_meta_illegal_characters() {
     
    383385        $krazy_key = ' f!@#$%^o *(){}o?+';
    384386        bp_xprofile_update_meta( $g, 'group', $krazy_key, 'bar' );
    385         $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) );
     387        $this->assertEmpty( bp_xprofile_get_meta( $g, 'group', 'foo' ) );
    386388    }
    387389
Note: See TracChangeset for help on using the changeset viewer.