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/activity/functions.php

    r7422 r7469  
    8787        $this->assertEquals( false, $m3 );
    8888    }
     89
     90    /**
     91     * @group bp_activity_update_meta
     92     * @ticket BP5180
     93     */
     94    public function test_bp_activity_update_meta_with_line_breaks() {
     95        $a = $this->factory->activity->create();
     96        $meta_value = 'Foo!
     97
     98
     99Bar!';
     100        bp_activity_update_meta( $a, 'linebreak_test', $meta_value );
     101        $this->assertEquals( $meta_value, bp_activity_get_meta( $a, 'linebreak_test' ) );
     102    }
    89103}
Note: See TracChangeset for help on using the changeset viewer.