From: Bill Pirkle Date: Thu, 13 Dec 2018 00:11:27 +0000 (-0600) Subject: Fix guzzle InvalidArgumentException when body is passed as an array X-Git-Tag: 1.34.0-rc.0~3261 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=32d9c56c27d99831a56b10f5b1e69996ebe505cd;p=lhc%2Fweb%2Fwiklou.git Fix guzzle InvalidArgumentException when body is passed as an array The postBody option to GuzzleHttpRequest can be passed as an array or as a string. We were previously handling the array case incorrectly. Bug: T211806 Change-Id: I8f40b9de9d40a9361eb45103608bf3aaa943bf73 --- diff --git a/includes/http/GuzzleHttpRequest.php b/includes/http/GuzzleHttpRequest.php index 5654a715aa..db8a09b970 100644 --- a/includes/http/GuzzleHttpRequest.php +++ b/includes/http/GuzzleHttpRequest.php @@ -91,7 +91,11 @@ class GuzzleHttpRequest extends MWHttpRequest { if ( $this->method == 'POST' ) { $postData = $this->postData; - $this->guzzleOptions['body'] = $postData; + if ( is_array( $postData ) ) { + $this->guzzleOptions['form_params'] = $postData; + } else { + $this->guzzleOptions['body'] = $postData; + } // Suppress 'Expect: 100-continue' header, as some servers // will reject it with a 417 and Curl won't auto retry