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