mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix UNKNOWN default values in ext/curl
Closes GH-5734
This commit is contained in:
parent
a43fd3bbef
commit
ed6fbf9174
6 changed files with 17 additions and 20 deletions
|
@ -33,11 +33,11 @@ function curl_multi_setopt(CurlMultiHandle $multi_handle, int $option, mixed $va
|
|||
|
||||
function curl_exec(CurlHandle $handle): string|bool {}
|
||||
|
||||
function curl_file_create(string $filename, string $mimetype = UNKNOWN, string $postname = UNKNOWN): CURLFile {}
|
||||
function curl_file_create(string $filename, ?string $mimetype = null, ?string $postname = null): CURLFile {}
|
||||
|
||||
function curl_getinfo(CurlHandle $handle, int $option = UNKNOWN): mixed {}
|
||||
function curl_getinfo(CurlHandle $handle, ?int $option = null): mixed {}
|
||||
|
||||
function curl_init(string $url = UNKNOWN): CurlHandle|false {}
|
||||
function curl_init(?string $url = null): CurlHandle|false {}
|
||||
|
||||
function curl_multi_add_handle(CurlMultiHandle $multi_handle, CurlHandle $handle): int {}
|
||||
|
||||
|
|
|
@ -41,17 +41,17 @@ ZEND_END_ARG_INFO()
|
|||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_curl_file_create, 0, 1, CURLFile, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimetype, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, postname, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_getinfo, 0, 1, IS_MIXED, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, option, IS_LONG, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_curl_init, 0, 0, CurlHandle, MAY_BE_FALSE)
|
||||
ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, url, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_add_handle, 0, 2, IS_LONG, 0)
|
||||
|
|
|
@ -35,8 +35,8 @@ static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
ZEND_PARSE_PARAMETERS_START(1,3)
|
||||
Z_PARAM_PATH_STR(fname)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR(mime)
|
||||
Z_PARAM_STR(postname)
|
||||
Z_PARAM_STR_OR_NULL(mime)
|
||||
Z_PARAM_STR_OR_NULL(postname)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
zend_update_property_string(curl_CURLFile_class, cf, "name", sizeof("name")-1, ZSTR_VAL(fname));
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
class CURLFile
|
||||
{
|
||||
public function __construct(
|
||||
string $filename,
|
||||
string $mimetype = UNKNOWN,
|
||||
string $postname = UNKNOWN
|
||||
) {}
|
||||
public function __construct(string $filename, ?string $mimetype = null, ?string $postname = null) {}
|
||||
|
||||
/** @return string */
|
||||
public function getFilename() {}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile___construct, 0, 0, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimetype, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, postname, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_getFilename, 0, 0, 0)
|
||||
|
|
|
@ -1861,7 +1861,7 @@ PHP_FUNCTION(curl_init)
|
|||
|
||||
ZEND_PARSE_PARAMETERS_START(0,1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR(url)
|
||||
Z_PARAM_STR_OR_NULL(url)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
cp = curl_easy_init();
|
||||
|
@ -3008,17 +3008,18 @@ PHP_FUNCTION(curl_getinfo)
|
|||
{
|
||||
zval *zid;
|
||||
php_curl *ch;
|
||||
zend_long option = 0;
|
||||
zend_long option;
|
||||
zend_bool option_is_null = 1;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_OBJECT_OF_CLASS(zid, curl_ce)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(option)
|
||||
Z_PARAM_LONG_OR_NULL(option, option_is_null)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ch = Z_CURL_P(zid);
|
||||
|
||||
if (ZEND_NUM_ARGS() < 2) {
|
||||
if (option_is_null) {
|
||||
char *s_code;
|
||||
/* libcurl expects long datatype. So far no cases are known where
|
||||
it would be an issue. Using zend_long would truncate a 64-bit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue