Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 6 additions & 37 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ ZEND_DECLARE_MODULE_GLOBALS(curl)
static zend_result php_curl_option_str(php_curl *ch, zend_long option, const char *str, const size_t len)
{
if (zend_char_has_nul_byte(str, len)) {
zend_value_error("%s(): cURL option must not contain any null bytes", get_active_function_name());
const struct curl_easyoption *option_info = curl_easy_option_by_id(option);
zend_value_error("%s(): cURL option CURLOPT_%s must not contain any null bytes", get_active_function_name(), option_info->name);
return FAILURE;
}

Expand Down Expand Up @@ -2030,43 +2031,10 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
HashTable *ph;
zend_string *val, *tmp_val;
struct curl_slist *slist = NULL;
const char *name = NULL;

switch (option) {
case CURLOPT_HTTPHEADER:
name = "CURLOPT_HTTPHEADER";
break;
case CURLOPT_QUOTE:
name = "CURLOPT_QUOTE";
break;
case CURLOPT_HTTP200ALIASES:
name = "CURLOPT_HTTP200ALIASES";
break;
case CURLOPT_POSTQUOTE:
name = "CURLOPT_POSTQUOTE";
break;
case CURLOPT_PREQUOTE:
name = "CURLOPT_PREQUOTE";
break;
case CURLOPT_TELNETOPTIONS:
name = "CURLOPT_TELNETOPTIONS";
break;
case CURLOPT_MAIL_RCPT:
name = "CURLOPT_MAIL_RCPT";
break;
case CURLOPT_RESOLVE:
name = "CURLOPT_RESOLVE";
break;
case CURLOPT_PROXYHEADER:
name = "CURLOPT_PROXYHEADER";
break;
case CURLOPT_CONNECT_TO:
name = "CURLOPT_CONNECT_TO";
break;
}

if (Z_TYPE_P(zvalue) != IS_ARRAY) {
zend_type_error("%s(): The %s option must have an array value", get_active_function_name(), name);
const struct curl_easyoption *option_info = curl_easy_option_by_id(option);
zend_type_error("%s(): The CURLOPT_%s option must have an array value", get_active_function_name(), option_info->name);
return FAILURE;
}

Expand All @@ -2078,7 +2046,8 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
if (zend_str_has_nul_byte(val)) {
curl_slist_free_all(slist);
zend_tmp_string_release(tmp_val);
zend_value_error("%s(): cURL option %s must not contain any null bytes", get_active_function_name(), name);
const struct curl_easyoption *option_info = curl_easy_option_by_id(option);
zend_value_error("%s(): cURL option CURLOPT_%s must not contain any null bytes", get_active_function_name(), option_info->name);
return FAILURE;
}

Expand Down
2 changes: 1 addition & 1 deletion ext/curl/sync-constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const SOURCE_FILE = __DIR__ . '/curl_arginfo.h';

const MIN_SUPPORTED_CURL_VERSION = '7.61.0';
const MIN_SUPPORTED_CURL_VERSION = '7.73.0';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change requires an RFC.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it violates the policy of supporting the cURL version that ships with a popular OS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7.61.1 is as high as we can go as far as I'm aware, and I want us to do that: #22232.


const IGNORED_CURL_CONSTANTS = [
'CURLOPT_PROGRESSDATA',
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/tests/bug68089.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ try {
?>
Done
--EXPECT--
curl_setopt(): cURL option must not contain any null bytes
curl_setopt(): cURL option CURLOPT_URL must not contain any null bytes
Done
Loading