Merge "Protect against non-arrays when fetching headers"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 17 Sep 2013 17:48:06 +0000 (17:48 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 17 Sep 2013 17:48:06 +0000 (17:48 +0000)
includes/WebRequest.php

index 55bddfc..23eee04 100644 (file)
@@ -881,8 +881,9 @@ class WebRequest {
                        return;
                }
 
-               if ( function_exists( 'apache_request_headers' ) ) {
-                       foreach ( apache_request_headers() as $tempName => $tempValue ) {
+               $apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : false;
+               if ( $apacheHeaders ) {
+                       foreach ( $apacheHeaders as $tempName => $tempValue ) {
                                $this->headers[strtoupper( $tempName )] = $tempValue;
                        }
                } else {