Skip to:
Content

BuddyPress.org


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

    r8056 r8129  
    357357    /**
    358358     * @group groupmeta
    359      *
    360      * @todo Why do we do this?
     359     * @group groups_get_groupmeta
     360     * @ticket BP5399
    361361     */
    362362    public function test_groups_get_groupmeta_with_illegal_key_characters() {
     
    365365
    366366        $krazy_key = ' f!@#$%^o *(){}o?+';
    367         $this->assertSame( groups_get_groupmeta( $g, 'foo' ), groups_get_groupmeta( $g, $krazy_key ) );
     367        $this->assertEmpty( groups_get_groupmeta( $g, $krazy_key ) );
    368368    }
    369369
     
    463463    /**
    464464     * @group groupmeta
     465     * @group groups_delete_groupmeta
     466     * @ticket BP5399
    465467     */
    466468    public function test_groups_delete_groupmeta_with_illegal_key_characters() {
     
    469471
    470472        $krazy_key = ' f!@#$%^o *(){}o?+';
    471         $this->assertTrue( groups_delete_groupmeta( $g, $krazy_key ) );
    472         $this->assertSame( '', groups_get_groupmeta( $g, 'foo' ) );
     473        $this->assertSame( 'bar', groups_get_groupmeta( $g, 'foo' ) );
    473474    }
    474475
Note: See TracChangeset for help on using the changeset viewer.