Skip to content

Commit 25eaa71

Browse files
committed
ClientBuilder fixes for PHP 5.4
Upstream GuzzleHttp\Ring\Client\CurlHandler (dubiously) requires `curl_reset` available from PHP 5.5, so when using `ClientBuilder::singleHandler() directly`, the check for `curl_reset` should take place or throw the Exception. `ClientBuilder::defaultHandler()` should also perform this check, falling back to Upstream GuzzleHttp\Ring\Client\CurlMultiHandler in environments where `curl_reset` is not available (the multi handler has no such dependency on curl_reset) The ClientBuilder::multiHandler() method doesn't require `curl_reset`, but does require `curl_multi_init`, which should be available to those with the curl extention.
1 parent f32e038 commit 25eaa71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Elasticsearch/ClientBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function defaultHandler($multiParams = [], $singleParams = [])
9595
$future = null;
9696
if (extension_loaded('curl')) {
9797
$config = array_merge([ 'mh' => curl_multi_init() ], $multiParams);
98-
if (function_exists('curl_multi_init')) {
98+
if (function_exists('curl_reset')) {
9999
$default = new CurlHandler($singleParams);
100100
$future = new CurlMultiHandler($config);
101101
} else {
@@ -127,7 +127,7 @@ public static function multiHandler($params = [])
127127
*/
128128
public static function singleHandler()
129129
{
130-
if (function_exists('curl_multi_init')) {
130+
if (function_exists('curl_reset')) {
131131
return new CurlHandler();
132132
} else {
133133
throw new \RuntimeException('CurlSingle handler requires cURL.');

0 commit comments

Comments
 (0)