Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/23/2013 06:47:16 PM (11 years ago)
Author:
boonebgorges
Message:

Sanitize more gently in component *_update_meta() functions

Previous sanitization techniques resulted in double-sanitization. Recent
changes in how WP's SQL sanitization routines work have surfaced this problem,
in particular as regards line breaks. By removing the extraneous call to
esc_sql(), we ensure that line breaks are preserved, and sanitization is left
to $wpdb->prepare().

Change applied in update_meta() functions through bp-groups, bp-activity, and
bp-xprofile. Also adds corresponding unit tests.

Fixes #5180

File:
1 edited

Legend:

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

    r7182 r7469  
    270270        $this->assertEquals( 1, groups_get_groupmeta( $g, 'total_member_count' ) );
    271271    }
     272
     273    /**
     274     * @group groupmeta
     275     * @ticket BP5180
     276     */
     277    public function test_groups_update_groupmeta_with_line_breaks() {
     278        $g = $this->factory->group->create();
     279        $meta_value = 'Foo!
     280
     281Bar!';
     282        groups_update_groupmeta( $g, 'linebreak_test', $meta_value );
     283
     284        $this->assertEquals( $meta_value, groups_get_groupmeta( $g, 'linebreak_test' ) );
     285    }
    272286}
Note: See TracChangeset for help on using the changeset viewer.