From e1b57310b1ec15b24e5ead8b63e58f74a0dbc988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 30 Dec 2019 17:35:46 +0100 Subject: [PATCH] Use RETURN_THROWS() during ZPP in main, sapi, win32, and Zend --- Zend/zend_builtin_functions.c | 64 ++++++++++++++--------------- Zend/zend_closures.c | 4 +- Zend/zend_generators.c | 12 +++--- main/SAPI.c | 2 +- main/main.c | 2 +- main/output.c | 30 +++++++------- main/streams/userspace.c | 6 +-- sapi/apache2handler/php_functions.c | 14 +++---- sapi/cgi/cgi_main.c | 6 +-- sapi/cli/php_cli_process_title.c | 4 +- sapi/cli/php_cli_server.c | 14 +++---- sapi/fpm/fpm/fpm_main.c | 6 +-- sapi/phpdbg/phpdbg.c | 22 +++++----- win32/codepage.c | 10 ++--- win32/signal.c | 4 +- 15 files changed, 100 insertions(+), 100 deletions(-) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index b24d620c71b..46d9b7a74f6 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -191,7 +191,7 @@ int zend_startup_builtin_functions(void) /* {{{ */ ZEND_FUNCTION(zend_version) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1); @@ -204,7 +204,7 @@ ZEND_FUNCTION(zend_version) ZEND_FUNCTION(gc_mem_caches) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(zend_mm_gc(zend_mm_get_heap())); @@ -217,7 +217,7 @@ ZEND_FUNCTION(gc_mem_caches) ZEND_FUNCTION(gc_collect_cycles) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(gc_collect_cycles()); @@ -229,7 +229,7 @@ ZEND_FUNCTION(gc_collect_cycles) ZEND_FUNCTION(gc_enabled) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_BOOL(gc_enabled()); @@ -243,7 +243,7 @@ ZEND_FUNCTION(gc_enable) zend_string *key; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); @@ -259,7 +259,7 @@ ZEND_FUNCTION(gc_disable) zend_string *key; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); @@ -275,7 +275,7 @@ ZEND_FUNCTION(gc_status) zend_gc_status status; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } zend_gc_get_status(&status); @@ -296,7 +296,7 @@ ZEND_FUNCTION(func_num_args) zend_execute_data *ex = EX(prev_execute_data); if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) { @@ -322,7 +322,7 @@ ZEND_FUNCTION(func_get_arg) zend_execute_data *ex; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &requested_offset) == FAILURE) { - return; + RETURN_THROWS(); } if (requested_offset < 0) { @@ -735,7 +735,7 @@ ZEND_FUNCTION(get_class) zval *obj = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &obj) == FAILURE) { - return; + RETURN_THROWS(); } if (!obj) { @@ -760,7 +760,7 @@ ZEND_FUNCTION(get_called_class) zend_class_entry *called_scope; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } called_scope = zend_get_called_scope(execute_data); @@ -784,7 +784,7 @@ ZEND_FUNCTION(get_parent_class) zend_class_entry *ce = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) { - return; + RETURN_THROWS(); } if (!ZEND_NUM_ARGS()) { @@ -933,7 +933,7 @@ ZEND_FUNCTION(get_class_vars) zend_class_entry *ce, *scope; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &class_name) == FAILURE) { - return; + RETURN_THROWS(); } ce = zend_lookup_class(class_name); @@ -1079,7 +1079,7 @@ ZEND_FUNCTION(get_class_methods) zend_string *key; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &klass) == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(klass) == IS_OBJECT) { @@ -1185,7 +1185,7 @@ ZEND_FUNCTION(property_exists) zend_property_info *property_info; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &object, &property) == FAILURE) { - return; + RETURN_THROWS(); } if (property == NULL) { @@ -1322,7 +1322,7 @@ ZEND_FUNCTION(class_alias) zend_bool autoload = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) { - return; + RETURN_THROWS(); } ce = zend_lookup_class_ex(class_name, NULL, !autoload ? ZEND_FETCH_CLASS_NO_AUTOLOAD : 0); @@ -1353,7 +1353,7 @@ ZEND_FUNCTION(get_included_files) zend_string *entry; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1374,7 +1374,7 @@ ZEND_FUNCTION(trigger_error) size_t message_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &message, &message_len, &error_type) == FAILURE) { - return; + RETURN_THROWS(); } switch (error_type) { @@ -1402,7 +1402,7 @@ ZEND_FUNCTION(set_error_handler) zend_long error_type = E_ALL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */ @@ -1437,7 +1437,7 @@ ZEND_FUNCTION(set_error_handler) ZEND_FUNCTION(restore_error_handler) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { @@ -1469,7 +1469,7 @@ ZEND_FUNCTION(set_exception_handler) zval *exception_handler; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */ @@ -1502,7 +1502,7 @@ ZEND_FUNCTION(set_exception_handler) ZEND_FUNCTION(restore_exception_handler) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { @@ -1535,7 +1535,7 @@ static inline void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int fla zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1585,7 +1585,7 @@ ZEND_FUNCTION(get_defined_functions) char *disable_functions = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) { - return; + RETURN_THROWS(); } array_init(&internal); @@ -1654,7 +1654,7 @@ ZEND_FUNCTION(get_resource_type) zval *z_resource_type; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_resource_type) == FAILURE) { - return; + RETURN_THROWS(); } resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type)); @@ -1676,7 +1676,7 @@ ZEND_FUNCTION(get_resources) zval *val; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &type) == FAILURE) { - return; + RETURN_THROWS(); } if (!type) { @@ -1729,7 +1729,7 @@ ZEND_FUNCTION(get_loaded_extensions) zend_bool zendext = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &zendext) == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1753,7 +1753,7 @@ ZEND_FUNCTION(get_defined_constants) zend_bool categorize = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &categorize) == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1939,7 +1939,7 @@ ZEND_FUNCTION(debug_print_backtrace) zend_long limit = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) { - return; + RETURN_THROWS(); } ZVAL_UNDEF(&arg_array); @@ -2327,7 +2327,7 @@ ZEND_FUNCTION(debug_backtrace) zend_long limit = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) { - return; + RETURN_THROWS(); } zend_fetch_debug_backtrace(return_value, 1, options, limit); @@ -2342,7 +2342,7 @@ ZEND_FUNCTION(extension_loaded) zend_string *lcname; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) { - return; + RETURN_THROWS(); } lcname = zend_string_tolower(extension_name); @@ -2366,7 +2366,7 @@ ZEND_FUNCTION(get_extension_funcs) zend_function *zif; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) { - return; + RETURN_THROWS(); } if (strncasecmp(ZSTR_VAL(extension_name), "zend", sizeof("zend"))) { lcname = zend_string_tolower(extension_name); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index b1bebaded43..3a17410b137 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -124,7 +124,7 @@ ZEND_METHOD(Closure, call) fci.params = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "o*", &newthis, &fci.params, &fci.param_count) == FAILURE) { - return; + RETURN_THROWS(); } closure = (zend_closure *) Z_OBJ_P(ZEND_THIS); @@ -333,7 +333,7 @@ ZEND_METHOD(Closure, fromCallable) char *error = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(callable) == IS_OBJECT && instanceof_function(Z_OBJCE_P(callable), zend_ce_closure)) { diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 068e1ceb137..7efe3435956 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -896,7 +896,7 @@ ZEND_METHOD(Generator, rewind) zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); @@ -912,7 +912,7 @@ ZEND_METHOD(Generator, valid) zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); @@ -932,7 +932,7 @@ ZEND_METHOD(Generator, current) zend_generator *generator, *root; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); @@ -955,7 +955,7 @@ ZEND_METHOD(Generator, key) zend_generator *generator, *root; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); @@ -978,7 +978,7 @@ ZEND_METHOD(Generator, next) zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); @@ -1071,7 +1071,7 @@ ZEND_METHOD(Generator, getReturn) zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } generator = (zend_generator *) Z_OBJ_P(ZEND_THIS); diff --git a/main/SAPI.c b/main/SAPI.c index 696cd9e2495..5ad40eec1e1 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -116,7 +116,7 @@ PHP_FUNCTION(header_register_callback) zval *callback_func; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) { - return; + RETURN_THROWS(); } if (!zend_is_callable(callback_func, 0, NULL)) { diff --git a/main/main.c b/main/main.c index 6902801f421..8e41ec9f497 100644 --- a/main/main.c +++ b/main/main.c @@ -1497,7 +1497,7 @@ PHP_FUNCTION(set_time_limit) zend_string *key; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &new_timeout) == FAILURE) { - return; + RETURN_THROWS(); } new_timeout_strlen = (int)zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout); diff --git a/main/output.c b/main/output.c index 6436a220e78..12905b455a8 100644 --- a/main/output.c +++ b/main/output.c @@ -1299,7 +1299,7 @@ PHP_FUNCTION(ob_start) zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zll", &output_handler, &chunk_size, &flags) == FAILURE) { - return; + RETURN_THROWS(); } if (chunk_size < 0) { @@ -1319,7 +1319,7 @@ PHP_FUNCTION(ob_start) PHP_FUNCTION(ob_flush) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!OG(active)) { @@ -1340,7 +1340,7 @@ PHP_FUNCTION(ob_flush) PHP_FUNCTION(ob_clean) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!OG(active)) { @@ -1361,7 +1361,7 @@ PHP_FUNCTION(ob_clean) PHP_FUNCTION(ob_end_flush) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!OG(active)) { @@ -1378,7 +1378,7 @@ PHP_FUNCTION(ob_end_flush) PHP_FUNCTION(ob_end_clean) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!OG(active)) { @@ -1395,7 +1395,7 @@ PHP_FUNCTION(ob_end_clean) PHP_FUNCTION(ob_get_flush) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (php_output_get_contents(return_value) == FAILURE) { @@ -1414,7 +1414,7 @@ PHP_FUNCTION(ob_get_flush) PHP_FUNCTION(ob_get_clean) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if(!OG(active)) { @@ -1437,7 +1437,7 @@ PHP_FUNCTION(ob_get_clean) PHP_FUNCTION(ob_get_contents) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (php_output_get_contents(return_value) == FAILURE) { @@ -1451,7 +1451,7 @@ PHP_FUNCTION(ob_get_contents) PHP_FUNCTION(ob_get_level) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(php_output_get_level()); @@ -1463,7 +1463,7 @@ PHP_FUNCTION(ob_get_level) PHP_FUNCTION(ob_get_length) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (php_output_get_length(return_value) == FAILURE) { @@ -1477,7 +1477,7 @@ PHP_FUNCTION(ob_get_length) PHP_FUNCTION(ob_list_handlers) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1497,7 +1497,7 @@ PHP_FUNCTION(ob_get_status) zend_bool full_status = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_status) == FAILURE) { - return; + RETURN_THROWS(); } if (!OG(active)) { @@ -1521,7 +1521,7 @@ PHP_FUNCTION(ob_implicit_flush) zend_long flag = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flag) == FAILURE) { - return; + RETURN_THROWS(); } php_output_set_implicit_flush(flag); @@ -1533,7 +1533,7 @@ PHP_FUNCTION(ob_implicit_flush) PHP_FUNCTION(output_reset_rewrite_vars) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (php_url_scanner_reset_vars() == SUCCESS) { @@ -1552,7 +1552,7 @@ PHP_FUNCTION(output_add_rewrite_var) size_t name_len, value_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) { - return; + RETURN_THROWS(); } if (php_url_scanner_add_var(name, name_len, value, value_len, 1) == SUCCESS) { diff --git a/main/streams/userspace.c b/main/streams/userspace.c index db3565a9018..20252deee92 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -498,7 +498,7 @@ PHP_FUNCTION(stream_wrapper_register) zend_long flags = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &protocol, &classname, &flags) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } uwrap = (struct php_user_stream_wrapper *)ecalloc(1, sizeof(*uwrap)); @@ -538,7 +538,7 @@ PHP_FUNCTION(stream_wrapper_unregister) zend_string *protocol; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } if (php_unregister_url_stream_wrapper_volatile(protocol) == FAILURE) { @@ -560,7 +560,7 @@ PHP_FUNCTION(stream_wrapper_restore) HashTable *global_wrapper_hash; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global(); diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index f19253026e5..d1aa2d587c4 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -73,7 +73,7 @@ PHP_FUNCTION(virtual) request_rec *rr; if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { - return; + RETURN_THROWS(); } if (!(rr = php_apache_lookup_uri(filename))) { @@ -119,7 +119,7 @@ PHP_FUNCTION(apache_lookup_uri) size_t filename_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { - return; + RETURN_THROWS(); } if (!(rr = php_apache_lookup_uri(filename))) { @@ -174,7 +174,7 @@ PHP_FUNCTION(apache_request_headers) char *key, *val; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -198,7 +198,7 @@ PHP_FUNCTION(apache_response_headers) char *key, *val; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -223,7 +223,7 @@ PHP_FUNCTION(apache_note) char *old_note_val=NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { - return; + RETURN_THROWS(); } ctx = SG(server_context); @@ -257,7 +257,7 @@ PHP_FUNCTION(apache_setenv) request_rec *r; if (zend_parse_parameters(arg_count, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) { - return; + RETURN_THROWS(); } ctx = SG(server_context); @@ -293,7 +293,7 @@ PHP_FUNCTION(apache_getenv) request_rec *r; if (zend_parse_parameters(arg_count, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) { - return; + RETURN_THROWS(); } ctx = SG(server_context); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index e459cc47fbd..c4719c6e465 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1575,7 +1575,7 @@ static PHP_MINFO_FUNCTION(cgi) PHP_FUNCTION(apache_child_terminate) /* {{{ */ { if (zend_parse_parameters_none()) { - return; + RETURN_THROWS(); } if (fcgi_is_fastcgi()) { fcgi_terminate(); @@ -1587,7 +1587,7 @@ PHP_FUNCTION(apache_child_terminate) /* {{{ */ PHP_FUNCTION(apache_request_headers) /* {{{ */ { if (zend_parse_parameters_none()) { - return; + RETURN_THROWS(); } array_init(return_value); if (fcgi_is_fastcgi()) { @@ -1700,7 +1700,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{ PHP_FUNCTION(apache_response_headers) /* {{{ */ { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c index f417549ed21..4437fdd46b2 100644 --- a/sapi/cli/php_cli_process_title.c +++ b/sapi/cli/php_cli_process_title.c @@ -31,7 +31,7 @@ PHP_FUNCTION(cli_set_process_title) int rc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &title, &title_len) == FAILURE) { - return; + RETURN_THROWS(); } rc = set_ps_title(title); @@ -53,7 +53,7 @@ PHP_FUNCTION(cli_get_process_title) int rc; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } rc = get_ps_title(&length, &title); diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index c6943a5442a..d83451f5f36 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -382,7 +382,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ zval tmp; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } client = SG(server_context); @@ -428,7 +428,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{ PHP_FUNCTION(apache_response_headers) /* {{{ */ { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -508,7 +508,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ if (php_cli_server_workers_max > 1) { zend_long php_cli_server_worker; - + php_cli_server_workers = calloc( php_cli_server_workers_max, sizeof(pid_t)); if (!php_cli_server_workers) { @@ -526,7 +526,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ if (pid == FAILURE) { /* no more forks allowed, work with what we have ... */ - php_cli_server_workers_max = + php_cli_server_workers_max = php_cli_server_worker + 1; return SUCCESS; } else if (pid == SUCCESS) { @@ -2317,14 +2317,14 @@ static void php_cli_server_dtor(php_cli_server *server) /* {{{ */ int php_cli_server_worker_status; do { - if (waitpid(php_cli_server_workers[php_cli_server_worker], - &php_cli_server_worker_status, + if (waitpid(php_cli_server_workers[php_cli_server_worker], + &php_cli_server_worker_status, 0) == FAILURE) { /* an extremely bad thing happened */ break; } - } while (!WIFEXITED(php_cli_server_worker_status) && + } while (!WIFEXITED(php_cli_server_worker_status) && !WIFSIGNALED(php_cli_server_worker_status)); } diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index dc49582cf6f..e278e4d8465 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1465,7 +1465,7 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */ fcgi_request *request = (fcgi_request*) SG(server_context); if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (!fcgi_is_closed(request)) { @@ -1487,7 +1487,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ fcgi_request *request; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } array_init(return_value); @@ -1501,7 +1501,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ PHP_FUNCTION(fpm_get_status) /* {{{ */ { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } if (fpm_status_export_to_zval(return_value)) { diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index cb0732ae5cf..c185fe75f6d 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -296,7 +296,7 @@ static PHP_FUNCTION(phpdbg_exec) zend_string *exec; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &exec) == FAILURE) { - return; + RETURN_THROWS(); } { @@ -336,7 +336,7 @@ static PHP_FUNCTION(phpdbg_break_next) zend_execute_data *ex; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } ex = EG(current_execute_data); @@ -359,7 +359,7 @@ static PHP_FUNCTION(phpdbg_break_file) zend_long line; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &file, &flen, &line) == FAILURE) { - return; + RETURN_THROWS(); } phpdbg_set_breakpoint_file(file, 0, line); @@ -372,7 +372,7 @@ static PHP_FUNCTION(phpdbg_break_method) size_t clen, mlen; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method, &mlen) == FAILURE) { - return; + RETURN_THROWS(); } phpdbg_set_breakpoint_method(class, method); @@ -385,7 +385,7 @@ static PHP_FUNCTION(phpdbg_break_function) size_t function_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) == FAILURE) { - return; + RETURN_THROWS(); } phpdbg_set_breakpoint_symbol(function, function_len); @@ -396,7 +396,7 @@ static PHP_FUNCTION(phpdbg_break_function) static PHP_FUNCTION(phpdbg_clear) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]); @@ -418,7 +418,7 @@ static PHP_FUNCTION(phpdbg_color) size_t color_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element, &color, &color_len) == FAILURE) { - return; + RETURN_THROWS(); } switch (element) { @@ -440,7 +440,7 @@ static PHP_FUNCTION(phpdbg_prompt) size_t prompt_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &prompt, &prompt_len) == FAILURE) { - return; + RETURN_THROWS(); } phpdbg_set_prompt(prompt); @@ -452,7 +452,7 @@ static PHP_FUNCTION(phpdbg_start_oplog) phpdbg_oplog_list *prev; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } prev = PHPDBG_G(oplog_list); @@ -539,7 +539,7 @@ static PHP_FUNCTION(phpdbg_get_executable) HashTable files_tmp; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) { - return; + RETURN_THROWS(); } if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("functions")))) { @@ -633,7 +633,7 @@ static PHP_FUNCTION(phpdbg_end_oplog) zend_bool by_opcode = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) { - return; + RETURN_THROWS(); } if (!PHPDBG_G(oplog_list)) { diff --git a/win32/codepage.c b/win32/codepage.c index e069030cbab..0f90c534b85 100644 --- a/win32/codepage.c +++ b/win32/codepage.c @@ -108,7 +108,7 @@ PW32CP wchar_t *php_win32_cp_conv_ascii_to_w(const char* in, size_t in_len, size #if PHP_DEBUG size_t save_in_len = in_len; #endif - + assert(in && in_len ? in[in_len] == '\0' : 1); if (!in) { @@ -563,7 +563,7 @@ PHP_FUNCTION(sapi_windows_cp_set) const struct php_win32_cp *cp; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; + RETURN_THROWS(); } if (ZEND_LONG_UINT_OVFL(id)) { @@ -593,7 +593,7 @@ PHP_FUNCTION(sapi_windows_cp_get) size_t kind_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &kind, &kind_len) == FAILURE) { - return; + RETURN_THROWS(); } if (kind_len == sizeof("ansi")-1 && !strncasecmp(kind, "ansi", kind_len)) { @@ -613,7 +613,7 @@ PHP_FUNCTION(sapi_windows_cp_get) PHP_FUNCTION(sapi_windows_cp_is_utf8) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } RETURN_BOOL(php_win32_cp_use_unicode()); @@ -631,7 +631,7 @@ PHP_FUNCTION(sapi_windows_cp_conv) zval *z_in_cp, *z_out_cp; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzs", &z_in_cp, &z_out_cp, &subj, &subj_len) == FAILURE) { - return; + RETURN_THROWS(); } if (ZEND_SIZE_T_INT_OVFL(subj_len)) { diff --git a/win32/signal.c b/win32/signal.c index 523ddfe1797..27ebf835c97 100644 --- a/win32/signal.c +++ b/win32/signal.c @@ -92,7 +92,7 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler) zend_bool add = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &handler, &add) == FAILURE) { - return; + RETURN_THROWS(); } #if ZTS @@ -143,7 +143,7 @@ PHP_FUNCTION(sapi_windows_generate_ctrl_event) zend_bool ret = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &evt, &pid) == FAILURE) { - return; + RETURN_THROWS(); } if (!php_win32_console_is_cli_sapi()) {