Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/07/2018 04:09:00 PM (6 years ago)
Author:
boonebgorges
Message:

Avoid passing non-variables to empty() throughout codebase.

This ensures full compatibility with versions of PHP earlier than 5.5.

In some cases, we avoid the use of empty() by moving to its equivalent,
! isset( $foo ) || ! $foo. In some cases, we convert the tested value
to a variable before passing to empty().

See #7998.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-core-oembed-extension.php

    r11447 r12281  
    425425            // Add markers to tell that we're embedding a single activity.
    426426            // This is needed for various oEmbed response data filtering.
    427             if ( empty( buddypress()->{$this->slug_endpoint} ) ) {
     427            if ( ! isset( buddypress()->{$this->slug_endpoint} ) || ! buddypress()->{$this->slug_endpoint} ) {
    428428                buddypress()->{$this->slug_endpoint} = new stdClass;
    429429            }
     
    534534
    535535            // Add custom route args to iframe.
    536             if ( ! empty( buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) ) {
     536            if ( isset( buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) && buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) {
    537537                foreach( buddypress()->{$this->slug_endpoint}->embedargs_in_progress as $key => $value ) {
    538538                    $url = add_query_arg( $key, $value, $url );
Note: See TracChangeset for help on using the changeset viewer.