Merge "Memory setting for djvutext is now a constant"
[lhc/web/wiklou.git] / includes / WebRequest.php
index 80fb81a..e251ac5 100644 (file)
@@ -380,10 +380,9 @@ class WebRequest {
                return $ret;
        }
 
-       
        /**
         * Unset an arbitrary value from our get/post data.
-        *
+        *
         * @param $key String: key name to use
         * @return Mixed: old value if one was present, null otherwise
         */
@@ -1048,11 +1047,17 @@ HTML;
         * @return String
         */
        protected function getRawIP() {
-               if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
-                       return IP::canonicalize( $_SERVER['REMOTE_ADDR'] );
-               } else {
+               if ( !isset( $_SERVER['REMOTE_ADDR'] ) ) {
                        return null;
                }
+
+               if ( is_array( $_SERVER['REMOTE_ADDR'] ) || strpos( $_SERVER['REMOTE_ADDR'], ',' ) !== false ) {
+                       throw new MWException( __METHOD__ . " : Could not determine the remote IP address due to multiple values." );
+               } else {
+                       $ipchain = $_SERVER['REMOTE_ADDR'];
+               }
+
+               return IP::canonicalize( $ipchain );
        }
 
        /**