Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:07:18 AM (12 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/activity/functions.php

    r8125 r8129  
    126126     * @group activitymeta
    127127     * @group bp_activity_update_meta
     128     * @ticket BP5399
    128129     */
    129130    public function test_bp_activity_update_meta_with_illegal_key_characters() {
     
    132133        bp_activity_update_meta( $a, $krazy_key, 'bar' );
    133134
    134         $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) );
     135        $this->assertEmpty( bp_activity_get_meta( $a, 'foo' ) );
    135136    }
    136137
     
    231232     * @group activitymeta
    232233     * @group bp_activity_get_meta
     234     * @ticket BP5399
    233235     */
    234236    public function test_bp_activity_get_meta_with_illegal_characters() {
     
    237239
    238240        $krazy_key = ' f!@#$%^o *(){}o?+';
    239         $this->assertNotEmpty( bp_activity_get_meta( $a, 'foo' ) );
    240         $this->assertSame( bp_activity_get_meta( $a, 'foo' ), bp_activity_get_meta( $a, $krazy_key ) );
     241        $this->assertEmpty( bp_activity_get_meta( $a, $krazy_key ) );
    241242    }
    242243
Note: See TracChangeset for help on using the changeset viewer.