* declare $ip and $ipchain so that it doesn't throw notices and warnings
* don't set $ip to false after getting it from $_SERVER['REMOTE_ADDR'], otherwise it won't work when there's no XFF header
* fix logic when throwing the exception: throw it when there's no IP
return $wgIP;
}
+ $ipchain = array();
+ $ip = false;
+
/* collect the originating ips */
# Client connecting to this webserver
if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
if( $ip ) {
$ipchain[] = $ip;
}
-
- $ip = false;
# Append XFF on to $ipchain
$forwardedFor = wfGetForwardedFor();
}
}
- if( $ip ) {
+ if( !$ip ) {
throw new MWException( "Unable to determine IP" );
}