Skip to:
Content

BuddyPress.org

Changeset 11026


Ignore:
Timestamp:
08/22/2016 10:00:25 PM (3 years ago)
Author:
r-a-y
Message:

In BP_Core_User::get_last_activity(), check if array key is set before integer casting.

Prevent PHP notices, which broke unit tests as of r11024. Boo Ray!

See #6977.

File:
1 edited

Legend:

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

    r11024 r11026  
    812812        foreach ( $user_ids as $user_id ) {
    813813            $retval[ $user_id ] = wp_cache_get( $user_id, 'bp_last_activity' );
    814             $retval[ $user_id ]['user_id']     = (int) $retval[ $user_id ]['user_id'];
    815             $retval[ $user_id ]['activity_id'] = (int) $retval[ $user_id ]['activity_id'];
     814
     815            if ( isset( $retval['user_id'] ) ) {
     816                $retval[ $user_id ]['user_id']     = (int) $retval[ $user_id ]['user_id'];
     817            }
     818            if ( isset( $retval['activity_id'] ) ) {
     819                $retval[ $user_id ]['activity_id'] = (int) $retval[ $user_id ]['activity_id'];
     820            }
    816821        }
    817822
Note: See TracChangeset for help on using the changeset viewer.