Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:37:28 AM (11 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/bp-activity/bp-activity-functions.php

    r8130 r8131  
    638638        }
    639639
    640         // If nothing was found, return false
     640        // If nothing was found, return empty string
    641641        if ( empty( $values ) ) {
    642             $retval = false;
     642            $retval = '';
    643643        } else {
    644644            $retval = $values;
    645645        }
    646     }
    647 
    648     // Legacy - On failure, expect false, not an empty string
    649     if ( '' === $retval ) {
    650         $retval = false;
    651646    }
    652647
Note: See TracChangeset for help on using the changeset viewer.