Skip to:
Content

BuddyPress.org

Changeset 12602


Ignore:
Timestamp:
03/28/2020 09:21:09 PM (20 months ago)
Author:
boonebgorges
Message:

isset() checks for a variety of variable references.

This helps to avoid PHP notices in 7.4+.

See #8264.

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r12586 r12602  
    34293429        $summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
    34303430    } elseif ( $use_media_type === 'images' ) {
    3431         $summary .= sprintf( ' <img src="%s">', esc_url( $extracted_media['url'] ) );
     3431        $extracted_media_url = isset( $extracted_media['url'] ) ? $extracted_media['url'] : '';
     3432        $summary .= sprintf( ' <img src="%s">', esc_url( $extracted_media_url ) );
    34323433    } elseif ( in_array( $use_media_type, array( 'audio', 'videos' ), true ) ) {
    34333434        $summary .= PHP_EOL . PHP_EOL . $extracted_media['original'];  // Full shortcode.
  • trunk/src/bp-core/classes/class-bp-attachment-cover-image.php

    r12588 r12602  
    7979
    8080        // File size is too big.
    81         if ( $file['size'] > $this->original_max_filesize ) {
     81        if ( isset( $file['size'] ) && ( $file['size'] > $this->original_max_filesize ) ) {
    8282            $file['error'] = 11;
    8383
    8484        // File is of invalid type.
    85         } elseif ( ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
     85        } elseif ( isset( $file['tmp_name'] ) && isset( $file['name'] ) && ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
    8686            $file['error'] = 12;
    8787        }
  • trunk/src/bp-core/classes/class-bp-media-extractor.php

    r11303 r12602  
    826826                foreach ( $images as $image_id ) {
    827827                    $image  = wp_get_attachment_image_src( $image_id, $image_size );
     828
     829                    $image_url    = isset( $image[0] ) ? $image[0] : '';
     830                    $image_width  = isset( $image[1] ) ? $image[1] : '';
     831                    $image_height = isset( $image[2] ) ? $image[2] : '';
     832
    828833                    $data[] = array(
    829                         'url'    => $image[0],
    830                         'width'  => $image[1],
    831                         'height' => $image[2],
     834                        'url'    => $image_url,
     835                        'width'  => $image_width,
     836                        'height' => $image_height,
    832837
    833838                        'gallery_id' => 1 + $gallery_id,
  • trunk/src/bp-core/classes/class-bp-user-query.php

    r12547 r12602  
    685685        // Set a last_activity value for each user, even if it's empty.
    686686        foreach ( $this->results as $user_id => $user ) {
    687             $user_last_activity = isset( $last_activities[ $user_id ] ) ? $last_activities[ $user_id ]['date_recorded'] : '';
     687            $user_last_activity = isset( $last_activities[ $user_id ]['date_recorded'] ) ? $last_activities[ $user_id ]['date_recorded'] : '';
    688688            $this->results[ $user_id ]->last_activity = $user_last_activity;
    689689        }
  • trunk/src/bp-friends/bp-friends-activity.php

    r12589 r12602  
    313313
    314314    // Get the requested action.
    315     $action = $filter['filter']['action'];
     315    $action = isset( $filter['filter']['action'] ) ? $filter['filter']['action'] : array();
    316316
    317317    // Make sure actions are listed in an array.
  • trunk/src/bp-members/bp-members-functions.php

    r12600 r12602  
    19241924        $user = array(
    19251925            'user_id'  => $user_id,
    1926             'password' => $signup->meta['password'],
     1926            'password' => isset( $signup->meta['password'] ) ? $signup->meta['password'] : '',
    19271927            'meta'     => $signup->meta,
    19281928        );
  • trunk/src/bp-messages/classes/class-bp-messages-box-template.php

    r12426 r12602  
    163163            ) );
    164164
    165             $this->threads            = $threads['threads'];
    166             $this->total_thread_count = $threads['total'];
     165            $this->threads            = isset( $threads['threads'] ) ? $threads['threads'] : array();
     166            $this->total_thread_count = isset( $threads['total'] ) ? $threads['total'] : 0;
    167167        }
    168168
  • trunk/src/bp-notifications/bp-notifications-functions.php

    r12307 r12602  
    234234                    $notification_object->href    = bp_loggedin_user_domain();
    235235                } else {
    236                     $notification_object->content = $content['text'];
    237                     $notification_object->href    = $content['link'];
     236                    $notification_object->content = isset( $content['text'] ) ? $content['text'] : '';
     237                    $notification_object->href    = isset( $content['link'] ) ? $content['link'] : '';
    238238                }
    239239
Note: See TracChangeset for help on using the changeset viewer.