diff --git a/classes/class-log.php b/classes/class-log.php index 5a8860122..b13b2beb8 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -242,8 +242,10 @@ public function is_record_excluded( $connector, $context, $action, $user = null, * @return boolean */ public function record_matches_rules( $record, $exclude_rules ) { + $matches_needed = count( $exclude_rules ); + $matches_found = 0; foreach ( $exclude_rules as $exclude_key => $exclude_value ) { - if ( ! isset( $record[ $exclude_key ] ) ) { + if ( ! isset( $record[ $exclude_key ] ) || is_null( $exclude_value ) ) { continue; } @@ -251,14 +253,14 @@ public function record_matches_rules( $record, $exclude_rules ) { $ip_addresses = explode( ',', $exclude_value ); if ( in_array( $record['ip_address'], $ip_addresses, true ) ) { - return true; + $matches_found++; } } elseif ( $record[ $exclude_key ] === $exclude_value ) { - return true; + $matches_found++; } } - return false; + return $matches_found === $matches_needed; } /**