diff --git a/pecl_http-3.0.1/src/php_http_client_curl.c b/pecl_http-3.0.1/src/php_http_client_curl.c index 2bcf533..011de5b 100644 --- a/pecl_http-3.0.1/src/php_http_client_curl.c +++ b/pecl_http-3.0.1/src/php_http_client_curl.c @@ -1645,7 +1645,7 @@ static ZEND_RESULT_CODE php_http_curle_set_option(php_http_option_t *opt, zval * rv = FAILURE; } } else if ((opt->flags & PHP_HTTP_CURLE_OPTION_CHECK_STRLEN) && !Z_STRLEN_P(val)) { - if (CURLE_OK != (rc = curl_easy_setopt(ch, opt->option, NULL))) { + if (CURLE_OK != (rc = curl_easy_setopt(ch, opt->option, ""))) { rv = FAILURE; } } else if ((opt->flags & PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR) && Z_STRVAL_P(val) && SUCCESS != php_check_open_basedir(Z_STRVAL_P(val))) { diff --git a/pecl_http-3.0.1/tests/client027.phpt b/pecl_http-3.0.1/tests/client027.phpt new file mode 100644 index 0000000..07a2724 --- /dev/null +++ b/pecl_http-3.0.1/tests/client027.phpt @@ -0,0 +1,43 @@ +--TEST-- +Empty string setOptions +--SKIPIF-- + +--FILE-- +setOptions(array("port" => $port)); + $request->setOptions(array("proxyhost" => '')); // override the invalid proxy + $request->setOptions(array("useragent" => '')); + $client = new http\Client; + $client->enqueue($request); + $client->send(); + echo $client->getResponse(); +}); +?> +===DONE=== +--EXPECTF-- +Test +HTTP/1.1 200 OK +Accept-Ranges: bytes +X-Request-Content-Length: 0 +Etag: "%s" +X-Original-Transfer-Encoding: chunked +Content-Length: 49 + +GET / HTTP/1.1 +Accept: */* +Host: localhost:%i + +===DONE===