summaryrefslogtreecommitdiff
path: root/ext/curl/interface.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2016-12-25 22:33:03 -0800
committerSara Golemon <pollita@php.net>2016-12-25 22:33:03 -0800
commita49675faacea0a9d93d4578b3fb86164a60cc323 (patch)
tree31bf827b2d7093d2de3769355751631994df78ff /ext/curl/interface.c
parent5d7c774bea967bb3c1b470f30e2c42dd76358f0f (diff)
parent7f29e7c67897e33ab8156f87122b37928393bd1a (diff)
downloadphp-git-a49675faacea0a9d93d4578b3fb86164a60cc323.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Interpretation of curl_setopt values for boolean parameters
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r--ext/curl/interface.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 741254c96a..9229bacea4 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2315,8 +2315,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
error = curl_easy_setopt(ch->cp, option, lval);
break;
case CURLOPT_SAFE_UPLOAD:
- lval = zval_get_long(zvalue);
- if (lval == 0) {
+ if (!zend_is_true(zvalue)) {
php_error_docref(NULL, E_WARNING, "Disabling safe uploads is no longer supported");
return FAILURE;
}
@@ -2652,13 +2651,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
break;
case CURLOPT_FOLLOWLOCATION:
- lval = zval_get_long(zvalue);
+ lval = zend_is_true(zvalue);
#if LIBCURL_VERSION_NUM < 0x071304
- if (PG(open_basedir) && *PG(open_basedir)) {
- if (lval != 0) {
- php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
- return FAILURE;
- }
+ if (lval && PG(open_basedir) && *PG(open_basedir)) {
+ php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
+ return FAILURE;
}
#endif
error = curl_easy_setopt(ch->cp, option, lval);
@@ -2814,8 +2811,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
break;
case CURLOPT_RETURNTRANSFER:
- lval = zval_get_long(zvalue);
- if (lval) {
+ if (zend_is_true(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
} else {
ch->handlers->write->method = PHP_CURL_STDOUT;
@@ -2891,8 +2887,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
case CURLINFO_HEADER_OUT:
- lval = zval_get_long(zvalue);
- if (lval == 1) {
+ if (zend_is_true(zvalue)) {
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);