From: Chad Horohoe Date: Thu, 11 Jun 2009 03:20:15 +0000 (+0000) Subject: (bug 18173) Login form exception on malformed REMOTE_ADDR, wfGetIP() now falls back... X-Git-Tag: 1.31.0-rc.0~41424 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=38b5865216a75facef81e37a5a6dcbc054667c57;p=lhc%2Fweb%2Fwiklou.git (bug 18173) Login form exception on malformed REMOTE_ADDR, wfGetIP() now falls back to 127.0.01 if the IP cannot be determined, which is more sane than returning null. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 232b091254..d693842b0d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -182,6 +182,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Multiple whitespace in TOC anchors is now stripped, for consistency with the link from the edit comment * (bug 19112) Preferences now respects $wgUseExternalEditor, $wgExternalDiffEngine +* (bug 18173) Login form exception on malformed REMOTE_ADDR, wfGetIP() now falls + back to 127.0.01 if the IP cannot be determined == API changes in 1.16 == diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 771fd57796..7331d74c9d 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -76,10 +76,10 @@ function wfGetIP() { /* collect the originating ips */ # Client connecting to this webserver - if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + if ( isset( $_SERVER['REMOTE_ADDR'] ) && IP::canonicalize( $_SERVER['REMOTE_ADDR'] ) ) { $ipchain = array( IP::canonicalize( $_SERVER['REMOTE_ADDR'] ) ); } else { - # Running on CLI? + # Running on CLI or REMOTE_ADDR is broken $ipchain = array( '127.0.0.1' ); } $ip = $ipchain[0];