Skip to content

Commit

Permalink
basically since you use a curl object which persists, so if you set t…
Browse files Browse the repository at this point in the history
…he payload in one request, but then do another request that doesn't have a payload the old payload was still being used. So I added a line to null the payload if none are sent.
  • Loading branch information
moos3 committed Sep 20, 2011
1 parent f0cd8b6 commit 024b3f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/transport/ElasticSearchTransportHTTP.php
Expand Up @@ -209,8 +209,11 @@ protected function call($url, $method="GET", $payload=false) {
curl_setopt($conn, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($conn, CURLOPT_FORBID_REUSE , 0) ;

if (is_array($payload) && count($payload) > 0)
if (is_array($payload) && count($payload) > 0) {
curl_setopt($conn, CURLOPT_POSTFIELDS, json_encode($payload)) ;
} else {
curl_setopt($conn, CURLOPT_POSTFIELDS, null);
}

$data = curl_exec($conn);
if ($data !== false)
Expand Down

0 comments on commit 024b3f0

Please sign in to comment.