com php-src: Interpretation of curl_setopt values for b oolean parameters: ext/curl/interface.c
| From: | Sara Golemon | Date: | Mon, 26 Dec 2016 06:32:49 +0000 |
| Subject: | com php-src: Interpretation of curl_setopt values for b oolean parameters: ext/curl/interface.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96431@lists.php.net to get a copy of this message | ||
Commit: 7f29e7c67897e33ab8156f87122b37928393bd1a
Author: dedal.qq <dedal.qq@gmail.com> Wed, 14 Dec 2016 00:52:16 +0300
Committer: Sara Golemon <pollita@php.net> Sun, 25 Dec 2016 22:32:49 -0800
Parents: e926bf65076cb5c8da6bf8f32635f696de5ff9aa
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7f29e7c67897e33ab8156f87122b37928393bd1a
Log:
Interpretation of curl_setopt values for boolean parameters
Changed paths:
M ext/curl/interface.c
Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 65539d1..8a354a3 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2302,8 +2302,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;
}
@@ -2639,13 +2638,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);
@@ -2801,8 +2798,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;
@@ -2878,8 +2874,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);