From 36281e4c45fb186fbf1af2d87d1a0393e5fd0157 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 22 Sep 2004 11:39:30 +0000 Subject: [PATCH] If $_SERVER['REMOTE_ADDR'] is not set, use 127.0.0.1 for $wgIP. This avoids an E_NOTIFY-level warning and avoids having the empty string set for the IP when running from CLI. --- includes/Setup.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/Setup.php b/includes/Setup.php index 51f70f918e..7a9ed19741 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -40,8 +40,11 @@ if( $wgUseSquid && isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { array_pop($hopips); } $wgIP = trim(end($hopips)); -} else { +} elseif( isset( $_SERVER['REMOTE_ADDR'] ) ) { $wgIP = $_SERVER['REMOTE_ADDR']; +} else { + # Running on CLI? + $wgIP = '127.0.0.1'; } -- 2.20.1