From: Antoine Musso Date: Mon, 15 Aug 2011 21:45:18 +0000 (+0000) Subject: back off r94558: X-Git-Tag: 1.31.0-rc.0~28245 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=56cc7371ddb24606e650f81e0c0205dda99d14cc;p=lhc%2Fweb%2Fwiklou.git back off r94558: - reverts ./includes/ProxyTools.php - marks tests broken In our test suite, the first call to wfGetIP() set the static variable. Hence the remaining of the code is only tested on the first call to it. Resetting the static variable enlight a bug somewhere in our code where we are calling wfGetIP() but can not reliably get an IP, somehow REMOTE_ADDR does not exist and $wgCommandLineMode is disabled. Will have to track this bug further when I got time. --- diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index f9671d9e60..e68729fb52 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -64,18 +64,12 @@ function wfGetAgent() { /** * Work out the IP address based on various globals * For trusted proxies, use the XFF client IP (first of the chain) - * @param $reset boolean Used to reset the internal static variable - * tracking the IP address. (default: false) * @return string */ -function wfGetIP( $reset = false ) { +function wfGetIP() { global $wgUsePrivateIPs, $wgCommandLineMode; static $ip = false; - if( $reset ) { - $ip = false; - } - # Return cached result if ( !empty( $ip ) ) { return $ip; diff --git a/tests/phpunit/includes/ProxyTools/wfGetIPTest.php b/tests/phpunit/includes/ProxyTools/wfGetIPTest.php index bef16b1e93..edaf0b7944 100644 --- a/tests/phpunit/includes/ProxyTools/wfGetIPTest.php +++ b/tests/phpunit/includes/ProxyTools/wfGetIPTest.php @@ -1,6 +1,10 @@