Skip to:
Content

BuddyPress.org

Ticket #5180: 5180.patch

File 5180.patch, 1.3 KB (added by boonebgorges, 12 years ago)
  • bp-groups/bp-groups-functions.php

    diff --git bp-groups/bp-groups-functions.php bp-groups/bp-groups-functions.php
    index 3f1d4eb..649f3ac 100644
    function groups_update_groupmeta( $group_id, $meta_key, $meta_value ) { 
    10441044
    10451045        $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
    10461046
    1047         if ( is_string( $meta_value ) )
    1048                 $meta_value = stripslashes( esc_sql( $meta_value ) );
     1047        if ( is_string( $meta_value ) ) {
     1048                $meta_value = stripslashes( $meta_value );
     1049        }
    10491050
    10501051        $meta_value = maybe_serialize( $meta_value );
    10511052
  • tests/testcases/groups/functions.php

    diff --git tests/testcases/groups/functions.php tests/testcases/groups/functions.php
    index 5fd9b6d..32d6899 100644
    class BP_Tests_Groups_Functions extends BP_UnitTestCase { 
    269269
    270270                $this->assertEquals( 1, groups_get_groupmeta( $g, 'total_member_count' ) );
    271271        }
     272
     273        /**
     274         * @group groupmeta
     275         * @ticket 5180
     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}