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;
}
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);
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;
}
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);