PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/component/http/class-remote-address.php +4 -3 5.5.1 → 6.3.0 View file →
@@ -59,9 +59,10 @@
59 59 * @param string $http_ip_header HTTP header for identifying client's IP.
60 60 *
61 61 * @since 4.5.1
62 62 */
63 - $http_ip_header = (string) apply_filters( 'wpdef_firewall_ip_detection', $this->http_ip_header );
63 + $http_ip_header = apply_filters( 'wpdef_firewall_ip_detection', $this->http_ip_header );
64 + $http_ip_header = is_string( $http_ip_header ) ? $http_ip_header : (string) $http_ip_header;
64 65 switch ( $http_ip_header ) {
65 66 case 'HTTP_X_FORWARDED_FOR':
66 67 case 'HTTP_X_REAL_IP':
67 68 case 'HTTP_CF_CONNECTING_IP':
@@ -103,15 +104,15 @@
103 104 */
104 105 public function get_http_ip_header_value( string $http_ip_header_key ): string {
105 106 $ip_array = array();
106 107 $server = defender_get_data_from_request( null, 's' );
107 - if ( empty( $http_ip_header_key ) ) {
108 + if ( '' === $http_ip_header_key ) {
108 109 $ip_array = wd_di()->get( Classic_Remote_Address::class )->get_ip_header();
109 110 } elseif ( isset( $server[ $http_ip_header_key ] ) ) {
110 111 $ip_array[] = $server[ $http_ip_header_key ];
111 112 }
112 113
113 - return ! empty( $ip_array ) ?
114 + return array() !== $ip_array ?
114 115 implode( ', ', $ip_array ) :
115 116 sprintf( /* translators: %s - HTTP IP header */
116 117 esc_html__( '%s header missing in $_SERVER global variable.', 'defender-security' ),
117 118 $http_ip_header_key