From d95c15e3717ad909a3e4736c4e26ee7a9331d7e1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 28 May 2019 12:11:32 +0200 Subject: [PATCH] Update MAY_BE_NULL for parts of ext/standard Also update proto comments to be more accurate. --- ext/opcache/Optimizer/zend_func_info.c | 46 +++++++++++++------------- ext/standard/basic_functions.c | 46 +++++++++++++------------- ext/standard/datetime.c | 2 +- ext/standard/string.c | 2 +- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 89cd1c3402..935cd7f5ba 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -140,19 +140,19 @@ static const func_info_t func_infos[] = { /* ext/standard */ FN("constant", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), - F1("bin2hex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("hex2bin", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("bin2hex", MAY_BE_FALSE | MAY_BE_STRING), + F1("hex2bin", MAY_BE_FALSE | MAY_BE_STRING), F0("sleep", MAY_BE_FALSE | MAY_BE_LONG), F0("usleep", MAY_BE_NULL | MAY_BE_FALSE), #if HAVE_NANOSLEEP - F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("time_sleep_until", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("time_nanosleep", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG), + F0("time_sleep_until", MAY_BE_FALSE | MAY_BE_TRUE), #endif #if HAVE_STRPTIME - F1("strptime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), + F1("strptime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), #endif F0("flush", MAY_BE_NULL), - F1("wordwrap", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("wordwrap", MAY_BE_FALSE | MAY_BE_STRING), F1("htmlspecialchars", MAY_BE_NULL | MAY_BE_STRING), F1("htmlentities", MAY_BE_NULL | MAY_BE_STRING), FN("html_entity_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), @@ -290,16 +290,16 @@ static const func_info_t func_infos[] = { F0("mt_srand", MAY_BE_NULL), F0("mt_getrandmax", MAY_BE_LONG), #if HAVE_GETSERVBYNAME - F0("getservbyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("getservbyname", MAY_BE_FALSE | MAY_BE_LONG), #endif #if HAVE_GETSERVBYPORT - F1("getservbyport", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("getservbyport", MAY_BE_FALSE | MAY_BE_STRING), #endif #if HAVE_GETPROTOBYNAME - F0("getprotobyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("getprotobyname", MAY_BE_FALSE | MAY_BE_LONG), #endif #if HAVE_GETPROTOBYNUMBER - F1("getprotobynumber", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("getprotobynumber", MAY_BE_FALSE | MAY_BE_STRING), #endif F0("getmyuid", MAY_BE_FALSE | MAY_BE_LONG), F0("getmygid", MAY_BE_FALSE | MAY_BE_LONG), @@ -360,11 +360,11 @@ static const func_info_t func_infos[] = { #ifdef HAVE_INET_PTON F1("inet_pton", MAY_BE_FALSE | MAY_BE_STRING), #endif - F0("ip2long", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F1("long2ip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("ip2long", MAY_BE_FALSE | MAY_BE_LONG), + F1("long2ip", MAY_BE_FALSE | MAY_BE_STRING), F1("getenv", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING), #ifdef HAVE_PUTENV - F0("putenv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("putenv", MAY_BE_FALSE | MAY_BE_TRUE), #endif F1("getopt", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #ifdef HAVE_GETLOADAVG @@ -386,12 +386,12 @@ static const func_info_t func_infos[] = { F1("get_current_user", MAY_BE_STRING), F0("set_time_limit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("header_register_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("get_cfg_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), + F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), F0("magic_quotes_runtime", MAY_BE_FALSE), F0("set_magic_quotes_runtime", MAY_BE_FALSE), F0("get_magic_quotes_gpc", MAY_BE_FALSE), F0("get_magic_quotes_runtime", MAY_BE_FALSE), - F0("error_log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("error_log", MAY_BE_FALSE | MAY_BE_TRUE), F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), FN("call_user_func", UNKNOWN_INFO), FN("call_user_func_array", UNKNOWN_INFO), @@ -413,14 +413,14 @@ static const func_info_t func_infos[] = { F1("highlight_file", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), F1("show_source", MAY_BE_FALSE | MAY_BE_STRING), F1("highlight_string", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), - F1("php_strip_whitespace", MAY_BE_FALSE | MAY_BE_STRING), - FN("ini_get", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("ini_get_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), - FN("ini_set", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("php_strip_whitespace", MAY_BE_STRING), + FN("ini_get", MAY_BE_FALSE | MAY_BE_STRING), + F1("ini_get_all", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), + FN("ini_set", MAY_BE_FALSE | MAY_BE_STRING), F1("ini_alter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("ini_restore", MAY_BE_NULL), F1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING), - F1("set_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("set_include_path", MAY_BE_FALSE | MAY_BE_STRING), F0("restore_include_path", MAY_BE_NULL), F0("setcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("setrawcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), @@ -431,14 +431,14 @@ static const func_info_t func_infos[] = { F0("http_response_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), F0("connection_aborted", MAY_BE_LONG), F0("connection_status", MAY_BE_LONG), - F0("ignore_user_abort", MAY_BE_NULL | MAY_BE_LONG), + F0("ignore_user_abort", MAY_BE_LONG), F1("parse_ini_file", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), F1("parse_ini_string", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #if ZEND_DEBUG F1("config_get_hash", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #endif - F0("is_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("move_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("is_uploaded_file", MAY_BE_FALSE | MAY_BE_TRUE), + F0("move_uploaded_file", MAY_BE_FALSE | MAY_BE_TRUE), F1("gethostbyaddr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("gethostbyname", MAY_BE_NULL | MAY_BE_STRING), F1("gethostbynamel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index b1e9be066e..d7d13a0df9 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3915,7 +3915,7 @@ PHP_FUNCTION(constant) /* }}} */ #ifdef HAVE_INET_NTOP -/* {{{ proto string inet_ntop(string in_addr) +/* {{{ proto string|false inet_ntop(string in_addr) Converts a packed inet address to a human readable IP address string */ PHP_NAMED_FUNCTION(zif_inet_ntop) { @@ -3947,7 +3947,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop) #endif /* HAVE_INET_NTOP */ #ifdef HAVE_INET_PTON -/* {{{ proto string inet_pton(string ip_address) +/* {{{ proto string|false inet_pton(string ip_address) Converts a human readable IP address to a packed binary string */ PHP_NAMED_FUNCTION(php_inet_pton) { @@ -3982,7 +3982,7 @@ PHP_NAMED_FUNCTION(php_inet_pton) /* }}} */ #endif /* HAVE_INET_PTON */ -/* {{{ proto int ip2long(string ip_address) +/* {{{ proto int|false ip2long(string ip_address) Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */ PHP_FUNCTION(ip2long) { @@ -4020,7 +4020,7 @@ PHP_FUNCTION(ip2long) } /* }}} */ -/* {{{ proto string long2ip(int proper_address) +/* {{{ proto string|false long2ip(int proper_address) Converts an (IPv4) Internet network address into a string in Internet standard dotted format */ PHP_FUNCTION(long2ip) { @@ -4055,7 +4055,7 @@ PHP_FUNCTION(long2ip) * System Functions * ********************/ -/* {{{ proto string getenv(string varname[, bool local_only] +/* {{{ proto string|array|false getenv([ string varname[, bool local_only]]) Get the value of an environment variable or every available environment variable if no varname is present */ PHP_FUNCTION(getenv) @@ -4350,7 +4350,7 @@ static int parse_opts(char * opts, opt_struct ** result) } /* }}} */ -/* {{{ proto array getopt(string options [, array longopts [, int &optind]]) +/* {{{ proto array|false getopt(string options [, array longopts [, int &optind]]) Get options from the command line argument list */ PHP_FUNCTION(getopt) { @@ -4626,7 +4626,7 @@ PHP_FUNCTION(time_nanosleep) } /* }}} */ -/* {{{ proto mixed time_sleep_until(float timestamp) +/* {{{ proto bool time_sleep_until(float timestamp) Make the script sleep until the specified time */ PHP_FUNCTION(time_sleep_until) { @@ -4716,7 +4716,7 @@ static void add_config_entries(HashTable *hash, zval *return_value) /* {{{ */ } /* }}} */ -/* {{{ proto mixed get_cfg_var(string option_name) +/* {{{ proto string|array|false get_cfg_var(string option_name) Get the value of a PHP configuration option */ PHP_FUNCTION(get_cfg_var) { @@ -4744,7 +4744,7 @@ PHP_FUNCTION(get_cfg_var) } /* }}} */ -/* {{{ proto int get_magic_quotes_runtime(void) +/* {{{ proto false get_magic_quotes_runtime(void) Get the current active configuration setting of magic_quotes_runtime */ PHP_FUNCTION(get_magic_quotes_runtime) { @@ -4755,7 +4755,7 @@ PHP_FUNCTION(get_magic_quotes_runtime) } /* }}} */ -/* {{{ proto int get_magic_quotes_gpc(void) +/* {{{ proto false get_magic_quotes_gpc(void) Get the current active configuration setting of magic_quotes_gpc */ PHP_FUNCTION(get_magic_quotes_gpc) { @@ -5169,7 +5169,7 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */ } /* }}} */ -/* {{{ proto void register_shutdown_function(callback function) U +/* {{{ proto false|null register_shutdown_function(callback function) U Register a user-level function to be called on request termination */ PHP_FUNCTION(register_shutdown_function) { @@ -5383,7 +5383,7 @@ PHP_FUNCTION(highlight_string) } /* }}} */ -/* {{{ proto string ini_get(string varname) +/* {{{ proto string|false ini_get(string varname) Get a configuration option */ PHP_FUNCTION(ini_get) { @@ -5413,7 +5413,7 @@ PHP_FUNCTION(ini_get) } /* }}} */ -/* {{{ proto array ini_get_all([string extension[, bool details = true]]) +/* {{{ proto array|false ini_get_all([string extension[, bool details = true]]) Get all configuration options */ PHP_FUNCTION(ini_get_all) { @@ -5495,7 +5495,7 @@ static int php_ini_check_path(char *option_name, size_t option_len, char *new_op } /* }}} */ -/* {{{ proto string ini_set(string varname, string newvalue) +/* {{{ proto string|false ini_set(string varname, string newvalue) Set a configuration option, returns false on error and the old value of the configuration option on success */ PHP_FUNCTION(ini_set) { @@ -5565,7 +5565,7 @@ PHP_FUNCTION(ini_restore) } /* }}} */ -/* {{{ proto string set_include_path(string new_include_path) +/* {{{ proto string|false set_include_path(string new_include_path) Sets the include_path configuration option */ PHP_FUNCTION(set_include_path) { @@ -5595,7 +5595,7 @@ PHP_FUNCTION(set_include_path) } /* }}} */ -/* {{{ proto string get_include_path() +/* {{{ proto string|false get_include_path() Get the current include_path configuration option */ PHP_FUNCTION(get_include_path) { @@ -5693,7 +5693,7 @@ PHP_FUNCTION(ignore_user_abort) /* }}} */ #if HAVE_GETSERVBYNAME -/* {{{ proto int getservbyname(string service, string protocol) +/* {{{ proto int|false getservbyname(string service, string protocol) Returns port associated with service. Protocol must be "tcp" or "udp" */ PHP_FUNCTION(getservbyname) { @@ -5736,7 +5736,7 @@ PHP_FUNCTION(getservbyname) #endif #if HAVE_GETSERVBYPORT -/* {{{ proto string getservbyport(int port, string protocol) +/* {{{ proto string|false getservbyport(int port, string protocol) Returns service name associated with port. Protocol must be "tcp" or "udp" */ PHP_FUNCTION(getservbyport) { @@ -5762,7 +5762,7 @@ PHP_FUNCTION(getservbyport) #endif #if HAVE_GETPROTOBYNAME -/* {{{ proto int getprotobyname(string name) +/* {{{ proto int|false getprotobyname(string name) Returns protocol number associated with name as per /etc/protocols */ PHP_FUNCTION(getprotobyname) { @@ -5786,7 +5786,7 @@ PHP_FUNCTION(getprotobyname) #endif #if HAVE_GETPROTOBYNUMBER -/* {{{ proto string getprotobynumber(int proto) +/* {{{ proto string|false getprotobynumber(int proto) Returns protocol name associated with protocol number proto */ PHP_FUNCTION(getprotobynumber) { @@ -6045,7 +6045,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, } /* }}} */ -/* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]]) +/* {{{ proto array|false parse_ini_file(string filename [, bool process_sections [, int scanner_mode]]) Parse configuration file */ PHP_FUNCTION(parse_ini_file) { @@ -6089,7 +6089,7 @@ PHP_FUNCTION(parse_ini_file) } /* }}} */ -/* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]]) +/* {{{ proto array|false parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]]) Parse configuration string */ PHP_FUNCTION(parse_ini_string) { @@ -6146,7 +6146,7 @@ PHP_FUNCTION(config_get_hash) /* {{{ */ #endif #ifdef HAVE_GETLOADAVG -/* {{{ proto array sys_getloadavg() +/* {{{ proto array|false sys_getloadavg() */ PHP_FUNCTION(sys_getloadavg) { diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index b1f0f26557..0ddce74f3d 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -69,7 +69,7 @@ PHPAPI char *php_std_date(time_t t) char *strptime(const char *s, const char *format, struct tm *tm); #endif -/* {{{ proto string strptime(string timestamp, string format) +/* {{{ proto array|false strptime(string timestamp, string format) Parse a time/date generated with strftime() */ PHP_FUNCTION(strptime) { diff --git a/ext/standard/string.c b/ext/standard/string.c index 3641b739f5..9c5b8c02ff 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -913,7 +913,7 @@ PHP_FUNCTION(ltrim) } /* }}} */ -/* {{{ proto string wordwrap(string str [, int width [, string break [, bool cut]]]) +/* {{{ proto string|false wordwrap(string str [, int width [, string break [, bool cut]]]) Wraps buffer to selected number of characters using string break char */ PHP_FUNCTION(wordwrap) { -- 2.40.0