Ensure MWHttpRequest::method gets set with strtoupper() since code
authorawjrichards <arichards@wikimedia.org>
Fri, 20 Apr 2012 22:17:55 +0000 (15:17 -0700)
committerawjrichards <arichards@wikimedia.org>
Fri, 20 Apr 2012 22:18:06 +0000 (15:18 -0700)
examining MWHttpRequest::method always expects its value to be
fully uppercased.

Yes, this should not be a problem if MWHttpRequest is accessed
via HTTP class, but that will not always be guaranteed.

Resolves bug 36137.

Change-Id: Ic20e1b99dcb56b8a11cea50293ba44022e564de9

includes/HttpFunctions.php

index a1d2e59..6adef84 100644 (file)
@@ -216,6 +216,11 @@ class MWHttpRequest {
 
                foreach ( $members as $o ) {
                        if ( isset( $options[$o] ) ) {
+                               // ensure that MWHttpRequest::method is always
+                               // uppercased. Bug 36137
+                               if ( $o == 'method' ) {
+                                       $options[$o] = strtoupper( $options[$o] );
+                               }
                                $this->$o = $options[$o];
                        }
                }