Index: branches/10.0/src/bp-friends/classes/class-bp-friends-friendship.php
===================================================================
--- branches/10.0/src/bp-friends/classes/class-bp-friends-friendship.php	(revision 13428)
+++ branches/10.0/src/bp-friends/classes/class-bp-friends-friendship.php	(revision 13429)
@@ -268,11 +268,4 @@
 		if ( empty( $user_id ) ) {
 			$user_id = bp_loggedin_user_id();
-		}
-
-		$friendships = array();
-		$operator    = strtoupper( $operator );
-
-		if ( ! in_array( $operator, array( 'AND', 'OR', 'NOT' ), true ) ) {
-			return $friendships;
 		}
 
@@ -310,7 +303,4 @@
 		}
 
-		$int_keys  = array( 'id', 'initiator_user_id', 'friend_user_id' );
-		$bool_keys = array( 'is_confirmed', 'is_limited' );
-
 		// Assemble filter array.
 		$filters = wp_array_slice_assoc( $r, array( 'id', 'initiator_user_id', 'friend_user_id', 'is_confirmed', 'is_limited' ) );
@@ -318,12 +308,11 @@
 			if ( is_null( $filter_value ) ) {
 				unset( $filters[ $filter_name ] );
-			} elseif ( in_array( $filter_name, $int_keys, true ) ) {
-				$filters[ $filter_name ] = (int) $filter_value;
-			} else {
-				$filters[ $filter_name ] = (bool) $filter_value;
 			}
 		}
 
 		// Populate friendship array from cache, and normalize.
+		$friendships = array();
+		$int_keys    = array( 'id', 'initiator_user_id', 'friend_user_id' );
+		$bool_keys   = array( 'is_confirmed', 'is_limited' );
 		foreach ( $friendship_ids as $friendship_id ) {
 			// Create a limited BP_Friends_Friendship object (don't fetch the user details).
@@ -346,15 +335,15 @@
 
 			// We need to support the same operators as wp_list_filter().
-			if ( 'OR' === $operator || 'NOT' === $operator ) {
+			if ( 'OR' == $operator || 'NOT' == $operator ) {
 				$matched = 0;
 
 				foreach ( $filters as $filter_name => $filter_value ) {
-					if ( isset( $friendship->{$filter_name} ) && $filter_value === $friendship->{$filter_name} ) {
+					if ( isset( $friendship->{$filter_name} ) && $filter_value == $friendship->{$filter_name} ) {
 						$matched++;
 					}
 				}
 
-				if ( ( 'OR' === $operator && $matched > 0 )
-				  || ( 'NOT' === $operator && 0 === $matched ) ) {
+				if ( ( 'OR' == $operator && $matched > 0 )
+				  || ( 'NOT' == $operator && 0 == $matched ) ) {
 					$friendships[ $friendship->id ] = $friendship;
 				}
@@ -366,5 +355,5 @@
 				 */
 				foreach ( $filters as $filter_name => $filter_value ) {
-					if ( ! isset( $friendship->{$filter_name} ) || $filter_value !== $friendship->{$filter_name} ) {
+					if ( ! isset( $friendship->{$filter_name} ) || $filter_value != $friendship->{$filter_name} ) {
 						continue 2;
 					}
@@ -443,17 +432,11 @@
 
 		$friendships = self::get_friendships( $user_id, $args );
-		$user_id     = (int) $user_id;
 
 		$fids = array();
 		foreach ( $friendships as $friendship ) {
-			$friend_id = $friendship->friend_user_id;
-			if ( $friendship->friend_user_id === $user_id ) {
-				$friend_id = $friendship->initiator_user_id;
-			}
-
 			if ( ! empty( $assoc_arr ) ) {
-				$fids[] = array( 'user_id' => $friend_id );
+				$fids[] = array( 'user_id' => ( $friendship->friend_user_id == $user_id ) ? $friendship->initiator_user_id : $friendship->friend_user_id );
 			} else {
-				$fids[] = $friend_id;
+				$fids[] = ( $friendship->friend_user_id == $user_id ) ? $friendship->initiator_user_id : $friendship->friend_user_id;
 			}
 		}
@@ -654,5 +637,5 @@
 
 		// Can't friend yourself.
-		if ( (int) $initiator_userid === (int) $possible_friend_userid ) {
+		if ( $initiator_userid === $possible_friend_userid ) {
 			return 'not_friends';
 		}
@@ -680,5 +663,4 @@
 
 		$bp                  = buddypress();
-		$user_id             = (int) $user_id;
 		$possible_friend_ids = wp_parse_id_list( $possible_friend_ids );
 
@@ -958,15 +940,7 @@
 		$sql     = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
 		$results = $wpdb->get_results( $sql );
-		$user_id = (int) $user_id;
 
 		for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
-			$friend_user_id    = (int) $results[ $i ]->friend_user_id;
-			$initiator_user_id = (int) $results[ $i ]->initiator_user_id;
-
-			if ( $friend_user_id === $user_id ) {
-				$fids[] = $initiator_user_id;
-			} else {
-				$fids[] = $friend_user_id;
-			}
+			$fids[] = ( $results[ $i ]->friend_user_id === $user_id ) ? $results[ $i ]->initiator_user_id : $results[ $i ]->friend_user_id;
 		}
 
@@ -1085,6 +1059,5 @@
 		global $wpdb;
 
-		$bp      = buddypress();
-		$user_id = (int) $user_id;
+		$bp = buddypress();
 
 		// Get all friendships, of any status, for the user.
@@ -1095,9 +1068,5 @@
 			$friendship_ids[] = $friendship->id;
 			if ( $friendship->is_confirmed ) {
-				if ( $friendship->friend_user_id === $user_id ) {
-					$friend_ids[] = $friendship->initiator_user_id;
-				} else {
-					$friend_ids[] = $friendship->friend_user_id;
-				}
+				$friend_ids[] = ( $friendship->friend_user_id == $user_id ) ? $friendship->initiator_user_id : $friendship->friend_user_id;
 			}
 		}
