From dba4ba6d53321d479a1d4fcfbae927dc0ed9e6a2 Mon Sep 17 00:00:00 2001 From: Patrick Bates Date: Sun, 11 Jun 2017 15:15:24 -0500 Subject: [PATCH] Fix for ipv4 client address containing a port number after a colon. Suspect this is an issue with IIS in general, though may be specific to Azure. May need to submit as bug to WP Core. --- wp-admin/includes/class-wp-community-events.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-admin/includes/class-wp-community-events.php b/wp-admin/includes/class-wp-community-events.php index 9a4145974..c90396b25 100644 --- a/wp-admin/includes/class-wp-community-events.php +++ b/wp-admin/includes/class-wp-community-events.php @@ -258,6 +258,9 @@ public static function get_unsafe_client_ip() { */ $address_chain = explode( ',', $_SERVER[ $header ] ); $client_ip = trim( $address_chain[0] ); + if ( (strlen($client_ip) < 25) && (stristr($client_ip, ":") !== FALSE) ) { + $client_ip = substr($client_ip, 0, strpos($client_ip, ":")); + } break; }