Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:37:28 AM (10 years ago)
Author:
boonebgorges
Message:

Return an empty string from get_meta() functions when no value is found

BP get_meta() functions have been inconsistent about the type of value returned
when no match is found for the object_id+meta_key combination. In some cases,
we followed WP's get_metadata() and returned an empty string. In others, we
returned false.

This changeset aligns all of our get_meta() functions with WP in this regard,
returning an empty string when no matching value is found. A boolean false is
still returned when invalid arguments are passed to the functions.

Relevant unit tests have been updated, including strict assertSame() checking
where appropriate.

See #5399

File:
1 edited

Legend:

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

    r8130 r8131  
    9494
    9595        $this->assertTrue( bp_blogs_delete_blogmeta( 1, 'foo', '', true ) );
    96         $this->assertEmpty( '', bp_blogs_get_blogmeta( 1, 'foo' ) );
    97         $this->assertEmpty( '', bp_blogs_get_blogmeta( 2, 'foo' ) );
     96        $this->assertSame( '', bp_blogs_get_blogmeta( 1, 'foo' ) );
     97        $this->assertSame( '', bp_blogs_get_blogmeta( 2, 'foo' ) );
    9898        $this->assertSame( 'bar1', bp_blogs_get_blogmeta( 1, 'foo1' ) );
    9999        $this->assertSame( 'bar1', bp_blogs_get_blogmeta( 2, 'foo1' ) );
     
    117117        bp_blogs_update_blogmeta( 1, 'foo', 'bar' );
    118118        $krazy_key = ' f!@#$%^o *(){}o?+';
    119         $this->assertEmpty( bp_blogs_get_blogmeta( 1, $krazy_key ) );
     119        $this->assertSame( '', bp_blogs_get_blogmeta( 1, $krazy_key ) );
    120120    }
    121121
     
    175175        $krazy_key = ' f!@#$%^o *(){}o?+';
    176176        bp_blogs_update_blogmeta( 1, $krazy_key, 'bar' );
    177         $this->assertEmpty( bp_blogs_get_blogmeta( 1, 'foo' ) );
     177        $this->assertSame( '', bp_blogs_get_blogmeta( 1, 'foo' ) );
    178178    }
    179179
Note: See TracChangeset for help on using the changeset viewer.