From: Michael Wallner Date: Tue, 24 May 2016 18:27:30 +0000 (+0200) Subject: Merge branch 'v2.6.x' X-Git-Tag: RELEASE_3_1_0_BETA1~17 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=54059a470e850eb8380bde2a4ed117e25c1b3e95;p=m6w6%2Fext-http Merge branch 'v2.6.x' --- 54059a470e850eb8380bde2a4ed117e25c1b3e95 diff --cc src/php_http_client_curl.c index 317edd3,d4f0517..e9fa112 --- a/src/php_http_client_curl.c +++ b/src/php_http_client_curl.c @@@ -1795,9 -1771,16 +1795,15 @@@ static ZEND_RESULT_CODE php_http_curlm_ } else { rc = curl_share_setopt(curl->handle->share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_COOKIE); } - return CURLSHE_OK == rc ? SUCCESS : FAILURE; + + if (CURLSHE_OK != rc) { - TSRMLS_FETCH_FROM_CTX(client->ts); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name.s, curl_share_strerror(rc)); ++ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_share_strerror(rc)); + return FAILURE; + } + return SUCCESS; } + #if PHP_HTTP_CURL_VERSION(7,23,0) static ZEND_RESULT_CODE php_http_curlm_option_set_share_ssl(php_http_option_t *opt, zval *value, void *userdata) { php_http_client_t *client = userdata; @@@ -1809,10 -1792,17 +1815,16 @@@ } else { rc = curl_share_setopt(curl->handle->share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_SSL_SESSION); } - return CURLSHE_OK == rc ? SUCCESS : FAILURE; + + if (CURLSHE_OK != rc) { - TSRMLS_FETCH_FROM_CTX(client->ts); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name.s, curl_share_strerror(rc)); ++ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_share_strerror(rc)); + return FAILURE; + } + return SUCCESS; } + #endif -static void php_http_curlm_options_init(php_http_options_t *registry TSRMLS_DC) +static void php_http_curlm_options_init(php_http_options_t *registry) { php_http_option_t *opt; @@@ -1864,14 -1854,16 +1876,16 @@@ } #endif /* share */ - if ((opt = php_http_option_register(registry, ZEND_STRL("share_cookies"), 0, IS_BOOL))) { + if ((opt = php_http_option_register(registry, ZEND_STRL("share_cookies"), 0, _IS_BOOL))) { opt->setter = php_http_curlm_option_set_share_cookies; - ZVAL_BOOL(&opt->defval, 1); + ZVAL_TRUE(&opt->defval); } + #if PHP_HTTP_CURL_VERSION(7,23,0) - if ((opt = php_http_option_register(registry, ZEND_STRL("share_ssl"), 0, IS_BOOL))) { + if ((opt = php_http_option_register(registry, ZEND_STRL("share_ssl"), 0, _IS_BOOL))) { opt->setter = php_http_curlm_option_set_share_ssl; - ZVAL_BOOL(&opt->defval, 1); + ZVAL_TRUE(&opt->defval); } + #endif } static ZEND_RESULT_CODE php_http_curlm_set_option(php_http_option_t *opt, zval *val, void *userdata) @@@ -1898,29 -1886,29 +1912,29 @@@ rv = opt->setter(opt, val, client); } else { switch (opt->type) { - case IS_BOOL: - if (CURLM_OK != (rc = curl_multi_setopt(ch, opt->option, (long) Z_BVAL_P(val)))) { + case _IS_BOOL: + if (CURLM_OK != (rc = curl_multi_setopt(ch, opt->option, (long) zend_is_true(val)))) { rv = FAILURE; - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name.s, curl_multi_strerror(rc)); ++ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_multi_strerror(rc)); } break; case IS_LONG: if (CURLM_OK != (rc = curl_multi_setopt(ch, opt->option, Z_LVAL_P(val)))) { rv = FAILURE; - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name.s, curl_multi_strerror(rc)); ++ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_multi_strerror(rc)); } break; default: rv = FAILURE; - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s", opt->name.s); ++ php_error_docref(NULL, E_NOTICE, "Could not set option %s", opt->name->val); break; } } if (val && val != orig && val != &opt->defval) { - zval_ptr_dtor(&val); + zval_ptr_dtor(val); } - if (rv != SUCCESS) { - php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc)); - } return rv; }