From 9e58187e9b750e9b0c9d43b99915ba1eaafcce0c Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 20:01:10 +0200 Subject: [PATCH 01/65] Voidify functions in zend.c --- Zend/zend.c | 4 +--- Zend/zend.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 775a1cdb69a43..d32b1e2b7e133 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -803,7 +803,7 @@ static zend_bool php_auto_globals_create_globals(zend_string *name) /* {{{ */ } /* }}} */ -int zend_startup(zend_utility_functions *utility_functions) /* {{{ */ +void zend_startup(zend_utility_functions *utility_functions) /* {{{ */ { #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -969,8 +969,6 @@ int zend_startup(zend_utility_functions *utility_functions) /* {{{ */ tsrm_set_new_thread_end_handler(zend_new_thread_end_handler); tsrm_set_shutdown_handler(zend_interned_strings_dtor); #endif - - return SUCCESS; } /* }}} */ diff --git a/Zend/zend.h b/Zend/zend.h index 5963ca7d9a7ac..690b2743a9464 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -227,7 +227,7 @@ typedef size_t (*zend_write_func_t)(const char *str, size_t str_length); #define zend_first_try EG(bailout)=NULL; zend_try BEGIN_EXTERN_C() -int zend_startup(zend_utility_functions *utility_functions); +void zend_startup(zend_utility_functions *utility_functions); void zend_shutdown(void); void zend_register_standard_ini_entries(void); int zend_post_startup(void); From 826c7880830a789c15afd93ef86b636dbb645269 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 20:16:58 +0200 Subject: [PATCH 02/65] Boolify functions in zend.c --- Zend/zend.c | 16 ++++----- Zend/zend.h | 12 +++---- Zend/zend_compile.c | 80 ++++++++++++++++++++++----------------------- Zend/zend_compile.h | 16 ++++----- main/main.c | 4 +-- 5 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index d32b1e2b7e133..34de8ff88ec13 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -74,7 +74,7 @@ ZEND_API zend_class_entry *zend_standard_class_def = NULL; ZEND_API size_t (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path); -ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +ZEND_API ZEND_RESULT_CODE (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); ZEND_API void (*zend_ticks_function)(int ticks); ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); @@ -82,9 +82,9 @@ void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_li void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); -ZEND_API int (*zend_post_startup_cb)(void) = NULL; +ZEND_API ZEND_RESULT_CODE (*zend_post_startup_cb)(void) = NULL; ZEND_API void (*zend_post_shutdown_cb)(void) = NULL; -ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL; +ZEND_API ZEND_RESULT_CODE (*zend_preload_autoload)(zend_string *filename) = NULL; /* This callback must be signal handler safe! */ void (*zend_on_timeout)(int seconds); @@ -365,7 +365,7 @@ static void print_flat_hash(HashTable *ht) /* {{{ */ } /* }}} */ -ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ +ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ { if (Z_TYPE_P(expr) == IS_STRING) { return 0; @@ -1019,7 +1019,7 @@ static void zend_resolve_property_types(void) /* {{{ */ /* Unlink the global (r/o) copies of the class, function and constant tables, * and use a fresh r/w copy for the startup thread */ -int zend_post_startup(void) /* {{{ */ +ZEND_RESULT_CODE zend_post_startup(void) /* {{{ */ { #ifdef ZTS zend_encoding **script_encoding_list; @@ -1031,7 +1031,7 @@ int zend_post_startup(void) /* {{{ */ zend_resolve_property_types(); if (zend_post_startup_cb) { - int (*cb)(void) = zend_post_startup_cb; + ZEND_RESULT_CODE (*cb)(void) = zend_post_startup_cb; zend_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -1663,13 +1663,13 @@ ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */ } } /* }}} */ -ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ { va_list files; int i; zend_file_handle *file_handle; zend_op_array *op_array; - int ret = SUCCESS; + ZEND_RESULT_CODE ret = SUCCESS; va_start(files, file_count); for (i = 0; i < file_count; i++) { diff --git a/Zend/zend.h b/Zend/zend.h index 690b2743a9464..fba45e0270c1d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -195,7 +195,7 @@ typedef struct _zend_utility_functions { zval *(*get_configuration_directive)(zend_string *name); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds); - int (*stream_open_function)(const char *filename, zend_file_handle *handle); + ZEND_RESULT_CODE (*stream_open_function)(const char *filename, zend_file_handle *handle); void (*printf_to_smart_string_function)(smart_string *buf, const char *format, va_list ap); void (*printf_to_smart_str_function)(smart_str *buf, const char *format, va_list ap); char *(*getenv_function)(const char *name, size_t name_len); @@ -230,7 +230,7 @@ BEGIN_EXTERN_C() void zend_startup(zend_utility_functions *utility_functions); void zend_shutdown(void); void zend_register_standard_ini_entries(void); -int zend_post_startup(void); +ZEND_RESULT_CODE zend_post_startup(void); void zend_set_utility_values(zend_utility_values *utility_values); ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno); @@ -246,7 +246,7 @@ ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const ch ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...); ZEND_API const char *get_zend_version(void); -ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy); +ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy); ZEND_API size_t zend_print_zval(zval *expr, int indent); ZEND_API void zend_print_zval_r(zval *expr, int indent); ZEND_API zend_string *zend_print_zval_r_to_str(zval *expr, int indent); @@ -283,18 +283,18 @@ extern ZEND_API void (*zend_ticks_function)(int ticks); extern ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); extern ZEND_API void (*zend_on_timeout)(int seconds); -extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +extern ZEND_API ZEND_RESULT_CODE (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); extern void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap); extern void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); /* These two callbacks are especially for opcache */ -extern ZEND_API int (*zend_post_startup_cb)(void); +extern ZEND_API ZEND_RESULT_CODE (*zend_post_startup_cb)(void); extern ZEND_API void (*zend_post_shutdown_cb)(void); /* Callback for loading of not preloaded part of the script */ -extern ZEND_API int (*zend_preload_autoload)(zend_string *filename); +extern ZEND_API ZEND_RESULT_CODE (*zend_preload_autoload)(zend_string *filename); ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a75c282d2d47e..3396c933e6658 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1076,7 +1076,7 @@ static zend_never_inline ZEND_COLD ZEND_NORETURN void do_bind_function_error(zen } } -ZEND_API int do_bind_function(zval *lcname) /* {{{ */ +ZEND_API ZEND_RESULT_CODE do_bind_function(zval *lcname) /* {{{ */ { zend_function *function; zval *rtd_key, *zv; @@ -1097,7 +1097,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */ } /* }}} */ -ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ { zend_class_entry *ce; zval *rtd_key, *zv; @@ -1356,7 +1356,7 @@ ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t fi } /* }}} */ -ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal) /* {{{ */ +ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal) /* {{{ */ { size_t prop_name_length = 1 + src1_length + 1 + src2_length; zend_string *prop_name = zend_string_alloc(prop_name_length, internal); @@ -1376,7 +1376,7 @@ static zend_always_inline size_t zend_strnlen(const char* s, size_t maxlen) /* { } /* }}} */ -ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ { size_t class_name_len; size_t anonclass_src_len; @@ -1749,10 +1749,10 @@ zend_bool zend_is_auto_global(zend_string *name) /* {{{ */ } /* }}} */ -int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ +ZEND_RESULT_CODE zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ { zend_auto_global auto_global; - int retval; + ZEND_RESULT_CODE retval; auto_global.name = name; auto_global.auto_global_callback = auto_global_callback; @@ -2105,7 +2105,7 @@ static inline uint32_t zend_emit_jump(uint32_t opnum_target) /* {{{ */ } /* }}} */ -ZEND_API int zend_is_smart_branch(const zend_op *opline) /* {{{ */ +ZEND_API bool zend_is_smart_branch(const zend_op *opline) /* {{{ */ { switch (opline->opcode) { case ZEND_IS_IDENTICAL: @@ -2419,7 +2419,7 @@ static void zend_emit_return_type_check( } /* }}} */ -void zend_emit_final_return(int return_one) /* {{{ */ +void zend_emit_final_return(bool return_one) /* {{{ */ { znode zn; zend_op *ret; @@ -2597,7 +2597,7 @@ static void zend_compile_class_ref(znode *result, zend_ast *name_ast, uint32_t f } /* }}} */ -static int zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ +static ZEND_RESULT_CODE zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ { zend_ast *name_ast = ast->child[0]; if (name_ast->kind == ZEND_AST_ZVAL) { @@ -2628,7 +2628,7 @@ static int zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ } /* }}} */ -static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */ +static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, bool delayed) /* {{{ */ { zend_ast *name_ast = ast->child[0]; znode name_node; @@ -2679,7 +2679,7 @@ static zend_bool this_guaranteed_exists() /* {{{ */ } /* }}} */ -static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */ +static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, bool delayed) /* {{{ */ { if (is_this_fetch(ast)) { zend_op *opline = zend_emit_op(result, ZEND_FETCH_THIS, NULL, NULL); @@ -2814,7 +2814,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t } /* }}} */ -static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, int by_ref) /* {{{ */ +static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ { uint32_t offset = zend_delayed_compile_begin(); zend_op *opline = zend_delayed_compile_prop(result, ast, type); @@ -2825,7 +2825,7 @@ static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, i } /* }}} */ -zend_op *zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, int by_ref, int delayed) /* {{{ */ +zend_op *zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref, bool delayed) /* {{{ */ { zend_ast *class_ast = ast->child[0]; zend_ast *prop_ast = ast->child[1]; @@ -3637,7 +3637,7 @@ static inline zend_bool zend_args_contain_unpack_or_named(zend_ast_list *args) / } /* }}} */ -int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -3657,7 +3657,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3677,7 +3677,7 @@ int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t typ } /* }}} */ -static int zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ +static ZEND_RESULT_CODE zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3692,7 +3692,7 @@ static int zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{ return SUCCESS; } -int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3712,7 +3712,7 @@ int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* } /* }}} */ -int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ { zend_string *name; zend_op *opline; @@ -3744,7 +3744,7 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && @@ -3762,7 +3762,7 @@ int zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && args->child[0]->kind == ZEND_AST_ZVAL && @@ -3784,7 +3784,7 @@ static zend_bool fbc_is_finalized(zend_function *fbc) { return !ZEND_USER_CODE(fbc->type) || (fbc->common.fn_flags & ZEND_ACC_DONE_PASS_TWO); } -static int zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ +static ZEND_RESULT_CODE zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ { zend_string *name, *lcname; zend_function *fbc; @@ -3837,7 +3837,7 @@ static void zend_compile_init_user_func(zend_ast *name_ast, uint32_t num_args, z /* }}} */ /* cufa = call_user_func_array */ -int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; @@ -3887,7 +3887,7 @@ int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcna /* }}} */ /* cuf = call_user_func */ -int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { uint32_t i; @@ -3958,7 +3958,7 @@ static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string } /* }}} */ -static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ +static ZEND_RESULT_CODE zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ { zend_bool strict = 0; znode array, needly; @@ -4043,7 +4043,7 @@ static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ } /* }}} */ -int zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; zend_op *opline; @@ -4060,7 +4060,7 @@ int zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcn } /* }}} */ -int zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 0) { zend_emit_op_tmp(result, ZEND_GET_CLASS, NULL, NULL); @@ -4078,7 +4078,7 @@ int zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children != 0) { return FAILURE; @@ -4089,7 +4089,7 @@ int zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{ } /* }}} */ -int zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -4103,7 +4103,7 @@ int zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_NUM_ARGS, NULL, NULL); @@ -4114,7 +4114,7 @@ int zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_GET_ARGS, NULL, NULL); @@ -4125,7 +4125,7 @@ int zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ { znode subject, needle; @@ -4141,7 +4141,7 @@ int zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{ } /* }}} */ -int zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ +ZEND_RESULT_CODE zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 2 @@ -4174,7 +4174,7 @@ int zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ +ZEND_RESULT_CODE zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ { if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) { return FAILURE; @@ -4641,7 +4641,7 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */ } /* }}} */ -static int zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value) /* {{{ */ +static bool zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value) /* {{{ */ { zend_loop_var *base; zend_loop_var *loop_var = zend_stack_top(&CG(loop_var_stack)); @@ -4690,13 +4690,13 @@ static int zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value } /* }}} */ -static int zend_handle_loops_and_finally(znode *return_value) /* {{{ */ +static bool zend_handle_loops_and_finally(znode *return_value) /* {{{ */ { return zend_handle_loops_and_finally_ex(zend_stack_count(&CG(loop_var_stack)) + 1, return_value); } /* }}} */ -static int zend_has_finally_ex(zend_long depth) /* {{{ */ +static bool zend_has_finally_ex(zend_long depth) /* {{{ */ { zend_loop_var *base; zend_loop_var *loop_var = zend_stack_top(&CG(loop_var_stack)); @@ -4722,7 +4722,7 @@ static int zend_has_finally_ex(zend_long depth) /* {{{ */ } /* }}} */ -static int zend_has_finally(void) /* {{{ */ +static bool zend_has_finally(void) /* {{{ */ { return zend_has_finally_ex(zend_stack_count(&CG(loop_var_stack)) + 1); } @@ -5859,7 +5859,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ } /* }}} */ -static int zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ +static ZEND_RESULT_CODE zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ { uint32_t i = 0; zend_ast_list *file_ast = zend_ast_get_list(CG(ast)); @@ -9603,7 +9603,7 @@ void zend_compile_expr(znode *result, zend_ast *ast) zend_short_circuiting_commit(checkpoint, result, ast); } -static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t type, int by_ref) +static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t type, bool by_ref) { CG(zend_lineno) = zend_ast_get_lineno(ast); @@ -9641,7 +9641,7 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty } } -zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, int by_ref) /* {{{ */ +zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ { uint32_t checkpoint = zend_short_circuiting_checkpoint(); zend_op *opcode = zend_compile_var_inner(result, ast, type, by_ref); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index df3171f76d1ef..2e3444863c6d8 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -133,7 +133,7 @@ typedef union _zend_parser_stack_elem { void zend_compile_top_stmt(zend_ast *ast); void zend_compile_stmt(zend_ast *ast); void zend_compile_expr(znode *node, zend_ast *ast); -zend_op *zend_compile_var(znode *node, zend_ast *ast, uint32_t type, int by_ref); +zend_op *zend_compile_var(znode *node, zend_ast *ast, uint32_t type, bool by_ref); void zend_eval_const_expr(zend_ast **ast_ptr); void zend_const_expr_to_zval(zval *result, zend_ast *ast); @@ -770,8 +770,8 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast); /* parser-driven code generators */ void zend_do_free(znode *op1); -ZEND_API int do_bind_function(zval *lcname); -ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name); +ZEND_API ZEND_RESULT_CODE do_bind_function(zval *lcname); +ZEND_API ZEND_RESULT_CODE do_bind_class(zval *lcname, zend_string *lc_parent_name); ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array); ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline); @@ -823,10 +823,10 @@ ZEND_API void zend_function_dtor(zval *zv); ZEND_API void destroy_zend_class(zval *zv); void zend_class_add_ref(zval *zv); -ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal); +ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal); #define zend_unmangle_property_name(mangled_property, class_name, prop_name) \ zend_unmangle_property_name_ex(mangled_property, class_name, prop_name, NULL) -ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); +ZEND_API ZEND_RESULT_CODE zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); static zend_always_inline const char *zend_get_unmangled_property_name(const zend_string *mangled_prop) { const char *class_name, *prop_name; @@ -847,7 +847,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers); uint32_t zend_get_class_fetch_type(zend_string *name); ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc); -ZEND_API int zend_is_smart_branch(const zend_op *opline); +ZEND_API ZEND_RESULT_CODE zend_is_smart_branch(const zend_op *opline); typedef zend_bool (*zend_auto_global_callback)(zend_string *name); typedef struct _zend_auto_global { @@ -857,7 +857,7 @@ typedef struct _zend_auto_global { zend_bool armed; } zend_auto_global; -ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); +ZEND_API ZEND_RESULT_CODE zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); ZEND_API void zend_activate_auto_globals(void); ZEND_API zend_bool zend_is_auto_global(zend_string *name); ZEND_API zend_bool zend_is_auto_global_str(const char *name, size_t len); @@ -974,7 +974,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type); #define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */ #define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x800 -static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask) +static zend_always_inline bool zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask) { arg_num--; if (UNEXPECTED(arg_num >= zf->common.num_args)) { diff --git a/main/main.c b/main/main.c index 9ac65da922758..ce6b91a9ad355 100644 --- a/main/main.c +++ b/main/main.c @@ -1520,13 +1520,13 @@ static size_t php_zend_stream_fsizer(void *handle) /* {{{ */ } /* }}} */ -static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ +static ZEND_RESULT_CODE php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ { return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE); } /* }}} */ -PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ +PHPAPI ZEND_RESULT_CODE php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ { zend_string *opened_path; php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &opened_path); From 976f9b19b77114308d655923a37d2139c638b889 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 20:18:15 +0200 Subject: [PATCH 03/65] Voidify functions in zend_alloc.c --- Zend/zend_alloc.c | 3 +-- Zend/zend_alloc.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 2236cf0dbb037..dfc657ce898be 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2657,12 +2657,11 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length) } -ZEND_API int zend_set_memory_limit(size_t memory_limit) +ZEND_API void zend_set_memory_limit(size_t memory_limit) { #if ZEND_MM_LIMIT AG(mm_heap)->limit = (memory_limit >= ZEND_MM_CHUNK_SIZE) ? memory_limit : ZEND_MM_CHUNK_SIZE; #endif - return SUCCESS; } ZEND_API size_t zend_memory_usage(int real_usage) diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 8bb854328dbdd..a05915e8eb77e 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -219,7 +219,7 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2) #define perealloc2_recoverable_rel(ptr, size, copy_size, persistent) ((persistent)?realloc((ptr), (size)):erealloc2_recoverable_rel((ptr), (size), (copy_size))) #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s)) -ZEND_API int zend_set_memory_limit(size_t memory_limit); +ZEND_API void zend_set_memory_limit(size_t memory_limit); ZEND_API void start_memory_manager(void); ZEND_API void shutdown_memory_manager(int silent, int full_shutdown); From 60019a936faf2d56e646d711dedc23f7d8640643 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 21:12:00 +0200 Subject: [PATCH 04/65] Boolify functions in zend_alloc.c --- Zend/zend_alloc.c | 14 +++++++------- Zend/zend_alloc.h | 18 +++++++++--------- main/main.c | 3 ++- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index dfc657ce898be..b6c89eff3007f 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2203,7 +2203,7 @@ static void *tracked_malloc(size_t size); static void tracked_free_all(); #endif -void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent) +void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent) { zend_mm_chunk *p; zend_mm_huge_list *list; @@ -2364,7 +2364,7 @@ static size_t alloc_globals_offset; static zend_alloc_globals alloc_globals; #endif -ZEND_API int is_zend_mm(void) +ZEND_API bool is_zend_mm(void) { #if ZEND_MM_CUSTOM return !AG(mm_heap)->use_custom_heap; @@ -2373,7 +2373,7 @@ ZEND_API int is_zend_mm(void) #endif } -ZEND_API int is_zend_ptr(const void *ptr) +ZEND_API bool is_zend_ptr(const void *ptr) { #if ZEND_MM_CUSTOM if (AG(mm_heap)->use_custom_heap) { @@ -2664,7 +2664,7 @@ ZEND_API void zend_set_memory_limit(size_t memory_limit) #endif } -ZEND_API size_t zend_memory_usage(int real_usage) +ZEND_API size_t zend_memory_usage(bool real_usage) { #if ZEND_MM_STAT if (real_usage) { @@ -2677,7 +2677,7 @@ ZEND_API size_t zend_memory_usage(int real_usage) return 0; } -ZEND_API size_t zend_memory_peak_usage(int real_usage) +ZEND_API size_t zend_memory_peak_usage(bool real_usage) { #if ZEND_MM_STAT if (real_usage) { @@ -2689,7 +2689,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage) return 0; } -ZEND_API void shutdown_memory_manager(int silent, int full_shutdown) +ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown) { zend_mm_shutdown(AG(mm_heap), full_shutdown, silent); } @@ -2818,7 +2818,7 @@ ZEND_API zend_mm_heap *zend_mm_get_heap(void) return AG(mm_heap); } -ZEND_API int zend_mm_is_custom_heap(zend_mm_heap *new_heap) +ZEND_API bool zend_mm_is_custom_heap(zend_mm_heap *new_heap) { #if ZEND_MM_CUSTOM return AG(mm_heap)->use_custom_heap; diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index a05915e8eb77e..ef97766eb5372 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -222,12 +222,12 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2) ZEND_API void zend_set_memory_limit(size_t memory_limit); ZEND_API void start_memory_manager(void); -ZEND_API void shutdown_memory_manager(int silent, int full_shutdown); -ZEND_API int is_zend_mm(void); -ZEND_API int is_zend_ptr(const void *ptr); +ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown); +ZEND_API bool is_zend_mm(void); +ZEND_API bool is_zend_ptr(const void *ptr); -ZEND_API size_t zend_memory_usage(int real_usage); -ZEND_API size_t zend_memory_peak_usage(int real_usage); +ZEND_API size_t zend_memory_usage(bool real_usage); +ZEND_API size_t zend_memory_peak_usage(bool real_usage); /* fast cache for HashTables */ #define ALLOC_HASHTABLE(ht) \ @@ -246,7 +246,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage); typedef struct _zend_mm_heap zend_mm_heap; ZEND_API zend_mm_heap *zend_mm_startup(void); -ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent); +ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full_shutdown, bool silent); ZEND_API void* ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void* ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); @@ -274,7 +274,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap); #define ZEND_MM_CUSTOM_HEAP_STD 1 #define ZEND_MM_CUSTOM_HEAP_DEBUG 2 -ZEND_API int zend_mm_is_custom_heap(zend_mm_heap *new_heap); +ZEND_API bool zend_mm_is_custom_heap(zend_mm_heap *new_heap); ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, void* (*_malloc)(size_t), void (*_free)(void*), @@ -295,8 +295,8 @@ typedef struct _zend_mm_storage zend_mm_storage; typedef void* (*zend_mm_chunk_alloc_t)(zend_mm_storage *storage, size_t size, size_t alignment); typedef void (*zend_mm_chunk_free_t)(zend_mm_storage *storage, void *chunk, size_t size); -typedef int (*zend_mm_chunk_truncate_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); -typedef int (*zend_mm_chunk_extend_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); +typedef bool (*zend_mm_chunk_truncate_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); +typedef bool (*zend_mm_chunk_extend_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); typedef struct _zend_mm_handlers { zend_mm_chunk_alloc_t chunk_alloc; diff --git a/main/main.c b/main/main.c index ce6b91a9ad355..a02a6698918bb 100644 --- a/main/main.c +++ b/main/main.c @@ -268,7 +268,8 @@ static PHP_INI_MH(OnChangeMemoryLimit) } else { PG(memory_limit) = Z_L(1)<<30; /* effectively, no limit */ } - return zend_set_memory_limit(PG(memory_limit)); + zend_set_memory_limit(PG(memory_limit)); + return SUCCESS; } /* }}} */ From 31309767fc8d632d9ee9db1f8dae8ab0bc4a30a5 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:19:38 +0200 Subject: [PATCH 05/65] Boolify functions in zend_API.c --- Zend/zend_API.c | 159 +++++++++++++++++------------------ Zend/zend_API.h | 210 +++++++++++++++++++++++------------------------ Zend/zend_hash.h | 44 +++++----- 3 files changed, 207 insertions(+), 206 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 92879137723bb..78867b804318b 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -42,7 +42,7 @@ static zend_module_entry **module_post_deactivate_handlers; static zend_class_entry **class_cleanup_handlers; -ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API ZEND_RESULT_CODE _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -64,7 +64,7 @@ ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_ } /* }}} */ -ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -369,7 +369,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null) /* {{{ */ { zend_class_entry *ce_base = *pce; @@ -398,7 +398,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) { *dest = zend_is_true(arg); @@ -409,7 +409,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -418,7 +418,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { @@ -461,7 +461,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -470,7 +470,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = (double)Z_LVAL_P(arg); @@ -499,7 +499,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) / } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { /* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */ @@ -511,7 +511,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) / } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -541,7 +541,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) { convert_to_string(arg); @@ -563,7 +563,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -572,7 +572,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -858,7 +858,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } /* }}} */ -static int zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ +static ZEND_RESULT_CODE zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ { const char *expected_type = NULL; char *error = NULL; @@ -886,10 +886,10 @@ static int zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char * } /* }}} */ -ZEND_API int zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) +ZEND_API ZEND_RESULT_CODE zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) { va_list va; - int ret; + ZEND_RESULT_CODE ret; va_start(va, spec); ret = zend_parse_arg(arg_num, arg, &va, &spec, flags); @@ -907,7 +907,7 @@ static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { ZSTR_VAL(active_function->common.function_name), msg); } -static int zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ +static ZEND_RESULT_CODE zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ { const char *spec_walk; char c; @@ -1049,10 +1049,10 @@ static int zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list } /* }}} */ -ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + ZEND_RESULT_CODE retval; va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags); @@ -1062,10 +1062,10 @@ ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char * } /* }}} */ -ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + ZEND_RESULT_CODE retval; int flags = 0; va_start(va, type_spec); @@ -1076,10 +1076,10 @@ ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ... } /* }}} */ -ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + ZEND_RESULT_CODE retval; int flags = 0; const char *p = type_spec; zval **object; @@ -1116,10 +1116,10 @@ ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, con } /* }}} */ -ZEND_API int zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + ZEND_RESULT_CODE retval; const char *p = type_spec; zval **object; zend_class_entry *ce; @@ -1172,7 +1172,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */ } /* }}} */ -ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ { if (!(class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) { zend_class_constant *c; @@ -1361,7 +1361,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties) * class and all props being public. If only a subset is given or the class * has protected members then you need to merge the properties separately by * calling zend_merge_properties(). */ -static zend_always_inline int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { @@ -1400,13 +1400,13 @@ static zend_always_inline int _object_and_properties_init(zval *arg, zend_class_ } /* }}} */ -ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +ZEND_API ZEND_RESULT_CODE object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { return _object_and_properties_init(arg, class_type, properties); } /* }}} */ -ZEND_API int object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ +ZEND_API ZEND_RESULT_CODE object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ { return _object_and_properties_init(arg, class_type, NULL); } @@ -1568,7 +1568,7 @@ ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, si } /* }}} */ -ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_long(zval *arg, zend_long n) /* {{{ */ { zval tmp; @@ -1577,7 +1577,7 @@ ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_null(zval *arg) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_null(zval *arg) /* {{{ */ { zval tmp; @@ -1586,7 +1586,7 @@ ZEND_API int add_next_index_null(zval *arg) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ { zval tmp; @@ -1595,7 +1595,7 @@ ZEND_API int add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ { zval tmp; @@ -1604,7 +1604,7 @@ ZEND_API int add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_double(zval *arg, double d) /* {{{ */ { zval tmp; @@ -1613,7 +1613,7 @@ ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_str(zval *arg, zend_string *str) /* {{{ */ { zval tmp; @@ -1622,7 +1622,7 @@ ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_string(zval *arg, const char *str) /* {{{ */ { zval tmp; @@ -1631,7 +1631,7 @@ ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ +ZEND_API ZEND_RESULT_CODE add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ { zval tmp; @@ -1640,7 +1640,7 @@ ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) / } /* }}} */ -ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ { zval *result; @@ -1767,7 +1767,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z } /* }}} */ -ZEND_API int zend_startup_module_ex(zend_module_entry *module) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_startup_module_ex(zend_module_entry *module) /* {{{ */ { size_t name_len; zend_string *lcname; @@ -2254,7 +2254,7 @@ ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, z } /* registers all functions in *library_functions in the function hash */ -ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ { const zend_function_entry *ptr = functions; zend_function function, *reg_function; @@ -2477,7 +2477,7 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in } /* }}} */ -ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_startup_module(zend_module_entry *module) /* {{{ */ { if ((module = zend_register_internal_module(module)) != NULL && zend_startup_module_ex(module) == SUCCESS) { return SUCCESS; @@ -2486,7 +2486,7 @@ ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */ } /* }}} */ -ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_get_module_started(const char *module_name) /* {{{ */ { zend_module_entry *module; @@ -2730,7 +2730,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or } /* }}} */ -ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent) /* {{{ */ { zend_string *lcname; zval zv, *ret; @@ -2765,7 +2765,8 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen } /* }}} */ -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +// TODO num_symbol_tables as unsigned int? +ZEND_API ZEND_RESULT_CODE zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ { HashTable *symbol_table; va_list symbol_table_list; @@ -2789,7 +2790,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_le /* Disabled functions support */ -ZEND_API int zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ { return zend_hash_str_del(CG(function_table), function_name, function_name_length); } @@ -2826,7 +2827,7 @@ static const zend_function_entry disabled_class_new[] = { ZEND_FE_END }; -ZEND_API int zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ { zend_class_entry *disabled_class; zend_string *key; @@ -2859,9 +2860,9 @@ static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame) return frame && frame->func ? frame->func->common.scope : NULL; } -static int zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, int *strict_class, char **error) /* {{{ */ +static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, int *strict_class, char **error) /* {{{ */ { - int ret = 0; + bool ret = 0; zend_class_entry *ce; size_t name_len = ZSTR_LEN(name); zend_string *lcname; @@ -2948,10 +2949,10 @@ ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) { fcc->function_handler = NULL; } -static zend_always_inline int zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, int strict_class, char **error) /* {{{ */ +static zend_always_inline bool zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, int strict_class, char **error) /* {{{ */ { zend_class_entry *ce_org = fcc->calling_scope; - int retval = 0; + bool retval = 0; zend_string *mname, *cname; zend_string *lmname; const char *colon; @@ -3390,7 +3391,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam } /* }}} */ -ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ { if (!zend_is_callable_ex(callable, NULL, check_flags, callable_name, fcc, error)) { return FAILURE; @@ -3444,7 +3445,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ } /* }}} */ -ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ { zval *arg, *params; uint32_t n = 1; @@ -3477,7 +3478,7 @@ ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, } /* }}} */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ { return zend_fcall_info_args_ex(fci, NULL, args); } @@ -3525,11 +3526,11 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...) /* } /* }}} */ -ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ { zval retval, *org_params = NULL; uint32_t org_count = 0; - int result; + ZEND_RESULT_CODE result; fci->retval = retval_ptr ? retval_ptr : &retval; if (args) { @@ -3680,7 +3681,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ { if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, val, strict))) { zval_ptr_dtor(val); @@ -3693,13 +3694,13 @@ ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_b } /* }}} */ -ZEND_API int zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ { return zend_try_assign_typed_ref_ex(ref, val, ZEND_ARG_USES_STRICT_TYPES()); } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3708,7 +3709,7 @@ ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ { zval tmp; @@ -3717,7 +3718,7 @@ ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ { zval tmp; @@ -3726,7 +3727,7 @@ ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ { zval tmp; @@ -3735,7 +3736,7 @@ ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3744,7 +3745,7 @@ ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ { zval tmp; @@ -3753,7 +3754,7 @@ ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ { zval tmp; @@ -3762,7 +3763,7 @@ ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *s } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ { zval tmp; @@ -3771,7 +3772,7 @@ ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char * } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ { zval tmp; @@ -3780,7 +3781,7 @@ ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ { zval tmp; @@ -3789,7 +3790,7 @@ ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *r } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ { zval tmp; @@ -3798,7 +3799,7 @@ ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ { zval tmp; @@ -4089,7 +4090,7 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object } /* }}} */ -ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ { zval *property, tmp; zend_property_info *prop_info; @@ -4125,7 +4126,7 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string } /* }}} */ -ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ { zend_string *key = zend_string_init(name, name_length, 0); int retval = zend_update_static_property_ex(scope, key, value); @@ -4134,7 +4135,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na } /* }}} */ -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ { zval tmp; @@ -4143,7 +4144,7 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4152,7 +4153,7 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4161,7 +4162,7 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ { zval tmp; @@ -4170,7 +4171,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ { zval tmp; @@ -4180,7 +4181,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ { zval tmp; @@ -4314,7 +4315,7 @@ ZEND_API zend_bool zend_is_countable(zval *countable) /* {{{ */ } /* }}} */ -static int get_default_via_ast(zval *default_value_zval, const char *default_value) { +static ZEND_RESULT_CODE get_default_via_ast(zval *default_value_zval, const char *default_value) { zend_ast *ast; zend_arena *ast_arena; @@ -4362,7 +4363,7 @@ static zend_string *try_parse_string(const char *str, size_t len, char quote) { return zend_string_init(str, len, 0); } -ZEND_API int zend_get_default_from_internal_arg_info( +ZEND_API ZEND_RESULT_CODE zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info) { const char *default_value = arg_info->default_value; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index adf84affd284f..feaeab2ea67c4 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -182,11 +182,11 @@ typedef struct _zend_fcall_info_cache { #define ZEND_MODULE_GLOBALS_DTOR_N(module) zm_globals_dtor_##module /* Declaration macros */ -#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) int ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) +#define ZEND_MODULE_STARTUP_D(module) ZEND_RESULT_CODE ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_SHUTDOWN_D(module) ZEND_RESULT_CODE ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_ACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_DEACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) #define ZEND_MODULE_INFO_D(module) ZEND_COLD void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS) #define ZEND_MODULE_GLOBALS_CTOR_D(module) void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals) #define ZEND_MODULE_GLOBALS_DTOR_D(module) void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals) @@ -283,10 +283,10 @@ typedef struct _zend_fcall_info_cache { ZEND_API int zend_next_free_module(void); BEGIN_EXTERN_C() -ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); +ZEND_API ZEND_RESULT_CODE _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); /* internal function to efficiently copy parameters when executing __call() */ -ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_array); +ZEND_API ZEND_RESULT_CODE zend_copy_parameters_array(uint32_t param_count, zval *argument_array); #define zend_get_parameters_array(ht, param_count, argument_array) \ _zend_get_parameters_array_ex(param_count, argument_array) @@ -301,27 +301,27 @@ ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_arr #define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */ #define ZEND_PARSE_PARAMS_QUIET (1<<1) -ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); -ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); +ZEND_API ZEND_RESULT_CODE zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); +ZEND_API ZEND_RESULT_CODE zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); /* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */ #define zend_parse_parameters_throw(num_args, ...) \ zend_parse_parameters(num_args, __VA_ARGS__) ZEND_API const char *zend_zval_type_name(const zval *arg); ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg); -ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API int zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API int zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); +ZEND_API ZEND_RESULT_CODE zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); /* End of parameter parsing API -- andrei */ -ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); +ZEND_API ZEND_RESULT_CODE zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table); -ZEND_API int zend_startup_module(zend_module_entry *module_entry); +ZEND_API ZEND_RESULT_CODE zend_startup_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module); -ZEND_API int zend_startup_module_ex(zend_module_entry *module); +ZEND_API ZEND_RESULT_CODE zend_startup_module_ex(zend_module_entry *module); ZEND_API void zend_startup_modules(void); ZEND_API void zend_collect_module_handlers(void); ZEND_API void zend_destroy_modules(void); @@ -334,15 +334,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry); ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_interfaces, ...); -ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent); +ZEND_API ZEND_RESULT_CODE zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent); #define zend_register_class_alias(name, ce) \ zend_register_class_alias_ex(name, sizeof(name)-1, ce, 1) #define zend_register_ns_class_alias(ns, name, ce) \ zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce, 1) -ZEND_API int zend_disable_function(const char *function_name, size_t function_name_length); -ZEND_API int zend_disable_class(const char *class_name, size_t class_name_length); +ZEND_API ZEND_RESULT_CODE zend_disable_function(const char *function_name, size_t function_name_length); +ZEND_API ZEND_RESULT_CODE zend_disable_class(const char *class_name, size_t class_name_length); ZEND_API ZEND_COLD void zend_wrong_param_count(void); @@ -378,7 +378,7 @@ ZEND_API void zend_declare_class_constant_double(zend_class_entry *ce, const cha ZEND_API void zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value); -ZEND_API int zend_update_class_constants(zend_class_entry *class_type); +ZEND_API ZEND_RESULT_CODE zend_update_class_constants(zend_class_entry *class_type); ZEND_API void zend_update_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zval *value); ZEND_API void zend_update_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zval *value); @@ -391,14 +391,14 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zend_object * ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_unset_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length); -ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); -ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); +ZEND_API ZEND_RESULT_CODE zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zend_bool silent, zval *rv); ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zend_bool silent, zval *rv); @@ -426,8 +426,8 @@ ZEND_API const char *zend_get_type_by_const(int type); #define array_init(arg) ZVAL_ARR((arg), zend_new_array(0)) #define array_init_size(arg, size) ZVAL_ARR((arg), zend_new_array(size)) ZEND_API void object_init(zval *arg); -ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce); -ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); +ZEND_API ZEND_RESULT_CODE object_init_ex(zval *arg, zend_class_entry *ce); +ZEND_API ZEND_RESULT_CODE object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type); ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties); ZEND_API void object_properties_load(zend_object *object, HashTable *properties); @@ -436,7 +436,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties); ZEND_API void add_assoc_long_ex(zval *arg, const char *key, size_t key_len, zend_long n); ZEND_API void add_assoc_null_ex(zval *arg, const char *key, size_t key_len); -ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, int b); +ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, bool b); ZEND_API void add_assoc_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r); ZEND_API void add_assoc_double_ex(zval *arg, const char *key, size_t key_len, double d); ZEND_API void add_assoc_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str); @@ -456,33 +456,33 @@ ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval ZEND_API void add_index_long(zval *arg, zend_ulong index, zend_long n); ZEND_API void add_index_null(zval *arg, zend_ulong index); -ZEND_API void add_index_bool(zval *arg, zend_ulong index, int b); +ZEND_API void add_index_bool(zval *arg, zend_ulong index, bool b); ZEND_API void add_index_resource(zval *arg, zend_ulong index, zend_resource *r); ZEND_API void add_index_double(zval *arg, zend_ulong index, double d); ZEND_API void add_index_str(zval *arg, zend_ulong index, zend_string *str); ZEND_API void add_index_string(zval *arg, zend_ulong index, const char *str); ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length); -static zend_always_inline int add_index_zval(zval *arg, zend_ulong index, zval *value) +static zend_always_inline ZEND_RESULT_CODE add_index_zval(zval *arg, zend_ulong index, zval *value) { return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE; } -ZEND_API int add_next_index_long(zval *arg, zend_long n); -ZEND_API int add_next_index_null(zval *arg); -ZEND_API int add_next_index_bool(zval *arg, zend_bool b); -ZEND_API int add_next_index_resource(zval *arg, zend_resource *r); -ZEND_API int add_next_index_double(zval *arg, double d); -ZEND_API int add_next_index_str(zval *arg, zend_string *str); -ZEND_API int add_next_index_string(zval *arg, const char *str); -ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length); +ZEND_API ZEND_RESULT_CODE add_next_index_long(zval *arg, zend_long n); +ZEND_API ZEND_RESULT_CODE add_next_index_null(zval *arg); +ZEND_API ZEND_RESULT_CODE add_next_index_bool(zval *arg, zend_bool b); +ZEND_API ZEND_RESULT_CODE add_next_index_resource(zval *arg, zend_resource *r); +ZEND_API ZEND_RESULT_CODE add_next_index_double(zval *arg, double d); +ZEND_API ZEND_RESULT_CODE add_next_index_str(zval *arg, zend_string *str); +ZEND_API ZEND_RESULT_CODE add_next_index_string(zval *arg, const char *str); +ZEND_API ZEND_RESULT_CODE add_next_index_stringl(zval *arg, const char *str, size_t length); -static zend_always_inline int add_next_index_zval(zval *arg, zval *value) +static zend_always_inline ZEND_RESULT_CODE add_next_index_zval(zval *arg, zval *value) { return zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE; } -ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value); +ZEND_API ZEND_RESULT_CODE array_set_zval_key(HashTable *ht, zval *key, zval *value); ZEND_API void add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l); ZEND_API void add_property_null_ex(zval *arg, const char *key, size_t key_len); @@ -505,7 +505,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value) -ZEND_API int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); +ZEND_API ZEND_RESULT_CODE _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); #define call_user_function(function_table, object, function_name, retval_ptr, param_count, params) \ _call_user_function_impl(object, function_name, retval_ptr, param_count, params, NULL) @@ -524,12 +524,12 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->params = NULL; * The callable_name argument may be NULL. */ -ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); +ZEND_API ZEND_RESULT_CODE zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); /** Clear arguments connected with zend_fcall_info *fci * If free_mem is not zero then the params array gets free'd as well */ -ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem); +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem); /** Save current arguments from zend_fcall_info *fci * params array will be set to NULL @@ -543,8 +543,8 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ /** Set or clear the arguments in the zend_call_info struct taking care of * refcount. If args is NULL and arguments are set then those are cleared. */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args); -ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); +ZEND_API ZEND_RESULT_CODE zend_fcall_info_args(zend_fcall_info *fci, zval *args); +ZEND_API ZEND_RESULT_CODE zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); /** Set arguments in the zend_fcall_info struct taking care of refcount. * If argc is 0 the arguments which are set will be cleared, else pass @@ -567,9 +567,9 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...); /** Call a function using information created by zend_fcall_info_init()/args(). * If args is given then those replace the argument info in fci is temporarily. */ -ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); +ZEND_API ZEND_RESULT_CODE zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); -ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); +ZEND_API ZEND_RESULT_CODE zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); /* Call the provided zend_function with the given params. * If retval_ptr is NULL, the return value is discarded. @@ -602,17 +602,17 @@ static zend_always_inline void zend_call_known_instance_method_with_1_params( ZEND_API void zend_call_known_instance_method_with_2_params( zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2); -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API ZEND_RESULT_CODE zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API int zend_delete_global_variable(zend_string *name); +ZEND_API ZEND_RESULT_CODE zend_delete_global_variable(zend_string *name); ZEND_API zend_array *zend_rebuild_symbol_table(void); ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data); ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data); -ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force); -ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force); +ZEND_API ZEND_RESULT_CODE zend_set_local_var(zend_string *name, zval *value, bool force); +ZEND_API ZEND_RESULT_CODE zend_set_local_var_str(const char *name, size_t len, zval *value, bool force); -static zend_always_inline int zend_forbid_dynamic_call(const char *func_name) +static zend_always_inline ZEND_RESULT_CODE zend_forbid_dynamic_call(const char *func_name) { zend_execute_data *ex = EG(current_execute_data); ZEND_ASSERT(ex != NULL && ex->func != NULL); @@ -631,7 +631,7 @@ ZEND_API zend_bool zend_is_iterable(zval *iterable); ZEND_API zend_bool zend_is_countable(zval *countable); -ZEND_API int zend_get_default_from_internal_arg_info( +ZEND_API ZEND_RESULT_CODE zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info); END_EXTERN_C() @@ -779,21 +779,21 @@ END_EXTERN_C() /* May modify arg in-place. Will free arg in failure case (and take ownership in success case). * Prefer using the ZEND_TRY_ASSIGN_* macros over these APIs. */ -ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); -ZEND_API int zend_try_assign_typed_ref(zend_reference *ref, zval *zv); - -ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref); -ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); -ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); -ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval); -ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref); -ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); -ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); -ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); -ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); -ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); -ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); -ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref(zend_reference *ref, zval *zv); + +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_null(zend_reference *ref); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_double(zend_reference *ref, double dval); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_empty_string(zend_reference *ref); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); +ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); #define _ZEND_TRY_ASSIGN_NULL(zv, is_ref) do { \ zval *_zv = zv; \ @@ -1771,19 +1771,19 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num /* Inlined implementations shared by new and old parameter parsing APIs */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null); -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long); - -static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null) +ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long); + +static zend_always_inline bool zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1801,7 +1801,7 @@ static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, ze return 1; } -static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null) +static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1817,7 +1817,7 @@ static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, ze return 1; } -static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zend_bool *is_null, int check_null) +static zend_always_inline bool zend_parse_arg_double(zval *arg, double *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1833,7 +1833,7 @@ static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zen return 1; } -static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int check_null) +static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG || Z_TYPE_P(arg) == IS_DOUBLE)) { *dest = arg; @@ -1845,7 +1845,7 @@ static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int return 1; } -static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, int check_null) +static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *dest = Z_STR_P(arg); @@ -1857,7 +1857,7 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, return 1; } -static zend_always_inline int zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, int check_null) +static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, bool check_null) { zend_string *str; @@ -1874,7 +1874,7 @@ static zend_always_inline int zend_parse_arg_string(zval *arg, char **dest, size return 1; } -static zend_always_inline int zend_parse_arg_path_str(zval *arg, zend_string **dest, int check_null) +static zend_always_inline bool zend_parse_arg_path_str(zval *arg, zend_string **dest, bool check_null) { if (!zend_parse_arg_str(arg, dest, check_null) || (*dest && UNEXPECTED(CHECK_NULL_PATH(ZSTR_VAL(*dest), ZSTR_LEN(*dest))))) { @@ -1883,7 +1883,7 @@ static zend_always_inline int zend_parse_arg_path_str(zval *arg, zend_string **d return 1; } -static zend_always_inline int zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, int check_null) +static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, bool check_null) { zend_string *str; @@ -1900,7 +1900,7 @@ static zend_always_inline int zend_parse_arg_path(zval *arg, char **dest, size_t return 1; } -static zend_always_inline int zend_parse_arg_array(zval *arg, zval **dest, int check_null, int or_object) +static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool check_null, bool or_object) { if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY) || (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT))) { @@ -1913,7 +1913,7 @@ static zend_always_inline int zend_parse_arg_array(zval *arg, zval **dest, int c return 1; } -static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **dest, int check_null, int or_object, int separate) +static zend_always_inline bool zend_parse_arg_array_ht(zval *arg, HashTable **dest, bool check_null, bool or_object, bool separate) { if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) { *dest = Z_ARRVAL_P(arg); @@ -1936,7 +1936,7 @@ static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **des return 1; } -static zend_always_inline int zend_parse_arg_object(zval *arg, zval **dest, zend_class_entry *ce, int check_null) +static zend_always_inline bool zend_parse_arg_object(zval *arg, zval **dest, zend_class_entry *ce, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT) && (!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce) != 0))) { @@ -1949,7 +1949,7 @@ static zend_always_inline int zend_parse_arg_object(zval *arg, zval **dest, zend return 1; } -static zend_always_inline int zend_parse_arg_resource(zval *arg, zval **dest, int check_null) +static zend_always_inline bool zend_parse_arg_resource(zval *arg, zval **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_RESOURCE)) { *dest = arg; @@ -1961,7 +1961,7 @@ static zend_always_inline int zend_parse_arg_resource(zval *arg, zval **dest, in return 1; } -static zend_always_inline int zend_parse_arg_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, int check_null, char **error) +static zend_always_inline bool zend_parse_arg_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, bool check_null, char **error) { if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { dest_fci->size = 0; @@ -1973,7 +1973,7 @@ static zend_always_inline int zend_parse_arg_func(zval *arg, zend_fcall_info *de return 1; } -static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, int check_null) +static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, bool check_null) { *dest = (check_null && (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) || @@ -1981,13 +1981,13 @@ static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, int c UNEXPECTED(Z_TYPE_P(Z_REFVAL_P(arg)) == IS_NULL)))) ? NULL : arg; } -static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest, int check_null) +static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest, bool check_null) { *dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg; } -static zend_always_inline int zend_parse_arg_str_or_array_ht( - zval *arg, zend_string **dest_str, HashTable **dest_ht, int allow_null) +static zend_always_inline bool zend_parse_arg_str_or_array_ht( + zval *arg, zend_string **dest_str, HashTable **dest_ht, bool allow_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *dest_str = Z_STR_P(arg); @@ -2005,8 +2005,8 @@ static zend_always_inline int zend_parse_arg_str_or_array_ht( return 1; } -static zend_always_inline int zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long, - zend_bool *is_null, int allow_null) +static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long, + zend_bool *is_null, bool allow_null) { if (allow_null) { *is_null = 0; @@ -2025,8 +2025,8 @@ static zend_always_inline int zend_parse_arg_str_or_long(zval *arg, zend_string return 1; } -static zend_always_inline int zend_parse_arg_class_name_or_obj( - zval *arg, zend_class_entry **destination, int allow_null +static zend_always_inline bool zend_parse_arg_class_name_or_obj( + zval *arg, zend_class_entry **destination, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *destination = zend_lookup_class(Z_STR_P(arg)); @@ -2043,8 +2043,8 @@ static zend_always_inline int zend_parse_arg_class_name_or_obj( return 1; } -static zend_always_inline int zend_parse_arg_str_or_obj( - zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, int allow_null +static zend_always_inline bool zend_parse_arg_str_or_obj( + zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) { diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index a9684b1dc2a2c..2dc4723978ddd 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -162,11 +162,11 @@ ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t /* Deletes */ -ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); -ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); -ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); -ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); -ZEND_API int ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p); /* Data retrieval */ @@ -227,11 +227,11 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *h #define zend_hash_has_more_elements_ex(ht, pos) \ (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) -ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); @@ -305,7 +305,7 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht); ZEND_API HashTable* ZEND_FASTCALL zend_symtable_to_proptable(HashTable *ht); ZEND_API HashTable* ZEND_FASTCALL zend_proptable_to_symtable(HashTable *ht, zend_bool always_duplicate); -ZEND_API int ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx); +ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx); ZEND_API uint32_t ZEND_FASTCALL zend_hash_iterator_add(HashTable *ht, HashPosition pos); ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterator_pos(uint32_t idx, HashTable *ht); @@ -351,7 +351,7 @@ END_EXTERN_C() #define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \ zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) -static zend_always_inline int _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx) +static zend_always_inline bool _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx) { const char *tmp = key; @@ -396,7 +396,7 @@ static zend_always_inline zval *zend_hash_find_ex_ind(const HashTable *ht, zend_ } -static zend_always_inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key) +static zend_always_inline bool zend_hash_exists_ind(const HashTable *ht, zend_string *key) { zval *zv; @@ -416,7 +416,7 @@ static zend_always_inline zval *zend_hash_str_find_ind(const HashTable *ht, cons } -static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len) +static zend_always_inline bool zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len) { zval *zv; @@ -460,7 +460,7 @@ static zend_always_inline zval *zend_symtable_update_ind(HashTable *ht, zend_str } -static zend_always_inline int zend_symtable_del(HashTable *ht, zend_string *key) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_del(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -472,7 +472,7 @@ static zend_always_inline int zend_symtable_del(HashTable *ht, zend_string *key) } -static zend_always_inline int zend_symtable_del_ind(HashTable *ht, zend_string *key) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_del_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -508,7 +508,7 @@ static zend_always_inline zval *zend_symtable_find_ind(const HashTable *ht, zend } -static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *key) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_exists(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -520,7 +520,7 @@ static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *k } -static zend_always_inline int zend_symtable_exists_ind(HashTable *ht, zend_string *key) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_exists_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -556,7 +556,7 @@ static zend_always_inline zval *zend_symtable_str_update_ind(HashTable *ht, cons } -static zend_always_inline int zend_symtable_str_del(HashTable *ht, const char *str, size_t len) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -568,7 +568,7 @@ static zend_always_inline int zend_symtable_str_del(HashTable *ht, const char *s } -static zend_always_inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -592,7 +592,7 @@ static zend_always_inline zval *zend_symtable_str_find(HashTable *ht, const char } -static zend_always_inline int zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) +static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -1149,7 +1149,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, ZEND_HASH_FILL_FINISH(); \ } while (0) -static zend_always_inline zval *_zend_hash_append_ex(HashTable *ht, zend_string *key, zval *zv, int interned) +static zend_always_inline zval *_zend_hash_append_ex(HashTable *ht, zend_string *key, zval *zv, bool interned) { uint32_t idx = ht->nNumUsed++; uint32_t nIndex; @@ -1175,7 +1175,7 @@ static zend_always_inline zval *_zend_hash_append(HashTable *ht, zend_string *ke return _zend_hash_append_ex(ht, key, zv, 0); } -static zend_always_inline zval *_zend_hash_append_ptr_ex(HashTable *ht, zend_string *key, void *ptr, int interned) +static zend_always_inline zval *_zend_hash_append_ptr_ex(HashTable *ht, zend_string *key, void *ptr, bool interned) { uint32_t idx = ht->nNumUsed++; uint32_t nIndex; From 26f0ad740099876cc3045797e34f519eccc19baf Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:26:38 +0200 Subject: [PATCH 06/65] Boolify functions in zend_ast.c --- Zend/zend_API.c | 20 ++++++++++---------- Zend/zend_ast.c | 16 ++++++++-------- Zend/zend_ast.h | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 78867b804318b..98905939c142e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -369,7 +369,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num } /* }}} */ -ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null) /* {{{ */ { zend_class_entry *ce_base = *pce; @@ -593,8 +593,8 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec { const char *spec_walk = *spec; char c = *spec_walk++; - int check_null = 0; - int separate = 0; + bool check_null = 0; + bool separate = 0; zval *real_arg = arg; /* scan through modifiers */ @@ -1436,7 +1436,7 @@ ZEND_API void add_assoc_null_ex(zval *arg, const char *key, size_t key_len) /* { } /* }}} */ -ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, int b) /* {{{ */ +ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, bool b) /* {{{ */ { zval tmp; @@ -1514,7 +1514,7 @@ ZEND_API void add_index_null(zval *arg, zend_ulong index) /* {{{ */ } /* }}} */ -ZEND_API void add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */ +ZEND_API void add_index_bool(zval *arg, zend_ulong index, bool b) /* {{{ */ { zval tmp; @@ -2860,7 +2860,7 @@ static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame) return frame && frame->func ? frame->func->common.scope : NULL; } -static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, int *strict_class, char **error) /* {{{ */ +static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool *strict_class, char **error) /* {{{ */ { bool ret = 0; zend_class_entry *ce; @@ -2949,7 +2949,7 @@ ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) { fcc->function_handler = NULL; } -static zend_always_inline bool zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, int strict_class, char **error) /* {{{ */ +static zend_always_inline bool zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool strict_class, char **error) /* {{{ */ { zend_class_entry *ce_org = fcc->calling_scope; bool retval = 0; @@ -3237,7 +3237,7 @@ static zend_always_inline zend_bool zend_is_callable_impl( { zend_bool ret; zend_fcall_info_cache fcc_local; - int strict_class = 0; + bool strict_class = 0; if (fcc == NULL) { fcc = &fcc_local; @@ -3409,7 +3409,7 @@ ZEND_API ZEND_RESULT_CODE zend_fcall_info_init(zval *callable, uint32_t check_fl } /* }}} */ -ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) /* {{{ */ +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem) /* {{{ */ { if (fci->params) { zval *p = fci->params; @@ -4129,7 +4129,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ { zend_string *key = zend_string_init(name, name_length, 0); - int retval = zend_update_static_property_ex(scope, key, value); + bool retval = zend_update_static_property_ex(scope, key, value); zend_string_efree(key); return retval; } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index e2a2aca698d48..c417189dd30fd 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -438,7 +438,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op) return (zend_ast *) list; } -static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) +static ZEND_RESULT_CODE zend_ast_add_array_element(zval *result, zval *offset, zval *expr) { switch (Z_TYPE_P(offset)) { case IS_UNDEF: @@ -478,7 +478,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) return SUCCESS; } -static int zend_ast_add_unpacked_element(zval *result, zval *expr) { +static ZEND_RESULT_CODE zend_ast_add_unpacked_element(zval *result, zval *expr) { if (EXPECTED(Z_TYPE_P(expr) == IS_ARRAY)) { HashTable *ht = Z_ARRVAL_P(expr); zval *val; @@ -505,10 +505,10 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) { return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) { zval op1, op2; - int ret = SUCCESS; + ZEND_RESULT_CODE ret = SUCCESS; switch (ast->kind) { case ZEND_AST_BINARY_OP: @@ -1059,7 +1059,7 @@ static ZEND_COLD void zend_ast_export_ns_name(smart_str *str, zend_ast *ast, int zend_ast_export_ex(str, ast, priority, indent); } -static ZEND_COLD int zend_ast_valid_var_char(char ch) +static ZEND_COLD bool zend_ast_valid_var_char(char ch) { unsigned char c = (unsigned char)ch; @@ -1072,7 +1072,7 @@ static ZEND_COLD int zend_ast_valid_var_char(char ch) return 1; } -static ZEND_COLD int zend_ast_valid_var_name(const char *s, size_t len) +static ZEND_COLD bool zend_ast_valid_var_name(const char *s, size_t len) { unsigned char c; size_t i; @@ -1098,7 +1098,7 @@ static ZEND_COLD int zend_ast_valid_var_name(const char *s, size_t len) return 1; } -static ZEND_COLD int zend_ast_var_needs_braces(char ch) +static ZEND_COLD bool zend_ast_var_needs_braces(char ch) { return ch == '[' || zend_ast_valid_var_char(ch); } @@ -1121,7 +1121,7 @@ static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int pri smart_str_appendc(str, '}'); } -static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, int separator, int priority, int indent) +static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent) { uint32_t i = 0; diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index 97236c5560c07..36f1ab665939f 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -290,7 +290,7 @@ ZEND_API zend_ast *zend_ast_create_decl( zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2, zend_ast *child3, zend_ast *child4 ); -ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); ZEND_API zend_string *zend_ast_export(const char *prefix, zend_ast *ast, const char *suffix); ZEND_API zend_ast_ref * ZEND_FASTCALL zend_ast_copy(zend_ast *ast); From 06f1fba7b1032ab15160bbe87b08aa9328d32743 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:27:40 +0200 Subject: [PATCH 07/65] Boolify functions in zend_attributes.c --- Zend/zend_attributes.c | 4 ++-- Zend/zend_attributes.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index e55f27f84a889..6ff35cbe4cd3c 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -116,7 +116,7 @@ ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, return get_attribute_str(attributes, str, len, offset + 1); } -ZEND_API int zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) +ZEND_API ZEND_RESULT_CODE zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) { if (i >= attr->argc) { return FAILURE; @@ -175,7 +175,7 @@ ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attrib return 0; } -static zend_always_inline void free_attribute(zend_attribute *attr, int persistent) +static zend_always_inline void free_attribute(zend_attribute *attr, bool persistent) { uint32_t i; diff --git a/Zend/zend_attributes.h b/Zend/zend_attributes.h index 6b7150a363dd9..02b0311a3465b 100644 --- a/Zend/zend_attributes.h +++ b/Zend/zend_attributes.h @@ -63,7 +63,7 @@ ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const cha ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset); ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset); -ZEND_API int zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); +ZEND_API ZEND_RESULT_CODE zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets); ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr); From 76e67628b85340cf1dcd009de15c0cd4238f0bbe Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:29:07 +0200 Subject: [PATCH 08/65] Boolify functions in zend_bitset.h --- Zend/zend_bitset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h index 2a227e482277b..9e196713f06fe 100644 --- a/Zend/zend_bitset.h +++ b/Zend/zend_bitset.h @@ -102,7 +102,7 @@ static inline void zend_bitset_clear(zend_bitset set, uint32_t len) memset(set, 0, len * ZEND_BITSET_ELM_SIZE); } -static inline int zend_bitset_empty(zend_bitset set, uint32_t len) +static inline bool zend_bitset_empty(zend_bitset set, uint32_t len) { uint32_t i; for (i = 0; i < len; i++) { From 002c1f6205c116bbaaa2a1c1d289530074583211 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:34:50 +0200 Subject: [PATCH 09/65] Boolify functions in zend_builtin_functions.c --- Zend/zend_builtin_functions.c | 14 +++++++------- Zend/zend_builtin_functions.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 588c3c33d7f71..ba10e62522259 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -57,7 +57,7 @@ zend_module_entry zend_builtin_module = { /* {{{ */ }; /* }}} */ -int zend_startup_builtin_functions(void) /* {{{ */ +ZEND_RESULT_CODE zend_startup_builtin_functions(void) /* {{{ */ { zend_builtin_module.module_number = 0; zend_builtin_module.type = MODULE_PERSISTENT; @@ -420,9 +420,9 @@ ZEND_FUNCTION(error_reporting) } /* }}} */ -static int validate_constant_array_argument(HashTable *ht, int argument_number) /* {{{ */ +static bool validate_constant_array_argument(HashTable *ht, int argument_number) /* {{{ */ { - int ret = 1; + bool ret = 1; zval *val; GC_PROTECT_RECURSION(ht); @@ -698,7 +698,7 @@ ZEND_FUNCTION(is_a) /* }}} */ /* {{{ add_class_vars */ -static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, int statics, zval *return_value) +static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, bool statics, zval *return_value) { zend_property_info *prop_info; zval *prop, prop_copy; @@ -865,10 +865,10 @@ ZEND_FUNCTION(get_mangled_object_vars) } /* }}} */ -static int same_name(zend_string *key, zend_string *name) /* {{{ */ +static bool same_name(zend_string *key, zend_string *name) /* {{{ */ { zend_string *lcname; - int ret; + bool ret; if (key == name) { return 1; @@ -2112,7 +2112,7 @@ ZEND_FUNCTION(get_extension_funcs) { zend_string *extension_name; zend_string *lcname; - int array; + bool array; zend_module_entry *module; zend_function *zif; diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index cfc347ed41ffc..4fda0e0abfa14 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -20,7 +20,7 @@ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H -int zend_startup_builtin_functions(void); +ZEND_RESULT_CODE zend_startup_builtin_functions(void); BEGIN_EXTERN_C() ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit); From a35d350e2070d98dae037989df5ac7f6fae8dcf5 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 22:51:07 +0200 Subject: [PATCH 10/65] Boolify functions in zend_closure.c --- Zend/zend_closures.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6b36bede37cbe..b2d6456cf7727 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -273,7 +273,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ { } /* }}} */ -static int zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { +static ZEND_RESULT_CODE zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { zend_fcall_info_cache fcc; zend_function *mptr; zval instance; @@ -361,6 +361,7 @@ static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object } /* }}} */ +/* int return due to Object Handler API */ static int zend_closure_compare(zval *o1, zval *o2) /* {{{ */ { ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2); @@ -513,6 +514,7 @@ int zend_closure_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_f } /* }}} */ +/* *is_temp is int due to Object Handler API */ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { zend_closure *closure = (zend_closure *)object; From 640bb8b46a2fd6c2606c88633f00dd0a3a4aa426 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 23:44:20 +0200 Subject: [PATCH 11/65] boolify zend_constant.c --- Zend/zend_constants.c | 15 ++++++--------- Zend/zend_constants.h | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index fe37e3fbd0454..2858fc15000d0 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -98,12 +98,10 @@ void clean_module_constants(int module_number) zend_hash_apply_with_argument(EG(zend_constants), clean_module_constant, (void *) &module_number); } - -int zend_startup_constants(void) +void zend_startup_constants(void) { EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1); - return SUCCESS; } @@ -144,11 +142,10 @@ void zend_register_standard_constants(void) } -int zend_shutdown_constants(void) +void zend_shutdown_constants(void) { zend_hash_destroy(EG(zend_constants)); free(EG(zend_constants)); - return SUCCESS; } ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number) @@ -266,7 +263,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /* } /* }}} */ -ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ +ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ { if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) { return 1; @@ -396,7 +393,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, } if (ret_constant && Z_TYPE_P(ret_constant) == IS_CONSTANT_AST) { - int ret; + ZEND_RESULT_CODE ret; if (IS_CONSTANT_VISITED(ret_constant)) { zend_throw_error(NULL, "Cannot declare self-referencing constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); @@ -480,11 +477,11 @@ static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_consta return ret; } -ZEND_API int zend_register_constant(zend_constant *c) +ZEND_API ZEND_RESULT_CODE zend_register_constant(zend_constant *c) { zend_string *lowercase_name = NULL; zend_string *name; - int ret = SUCCESS; + ZEND_RESULT_CODE ret = SUCCESS; zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; #if 0 diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index 9b5a63a0260d9..6090623c07820 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -69,10 +69,10 @@ typedef struct _zend_constant { BEGIN_EXTERN_C() void clean_module_constants(int module_number); void free_zend_constant(zval *zv); -int zend_startup_constants(void); -int zend_shutdown_constants(void); +void zend_startup_constants(void); +void zend_shutdown_constants(void); void zend_register_standard_constants(void); -ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce); +ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce); ZEND_API zval *zend_get_constant(zend_string *name); ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len); ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags); @@ -82,7 +82,7 @@ ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zen ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number); ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number); ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number); -ZEND_API int zend_register_constant(zend_constant *c); +ZEND_API ZEND_RESULT_CODE zend_register_constant(zend_constant *c); #ifdef ZTS void zend_copy_constants(HashTable *target, HashTable *sourc); #endif From 88efdd17995153b3827410e5cd1e6fa4b662182d Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 23:49:12 +0200 Subject: [PATCH 12/65] Boolify zend_exception.c --- Zend/zend_exceptions.c | 8 ++++---- Zend/zend_exceptions.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 2923165e56651..7d709882eedce 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -50,7 +50,7 @@ ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); static zend_object_handlers default_exception_handlers; /* {{{ zend_implement_throwable */ -static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) +static ZEND_RESULT_CODE zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { if (instanceof_function(class_type, zend_ce_exception) || instanceof_function(class_type, zend_ce_error)) { return SUCCESS; @@ -213,7 +213,7 @@ ZEND_API void zend_clear_exception(void) /* {{{ */ } /* }}} */ -static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces) /* {{{ */ +static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, bool skip_top_traces) /* {{{ */ { zval tmp; zval trace; @@ -908,11 +908,11 @@ static void zend_error_va(int type, const char *file, uint32_t lineno, const cha /* }}} */ /* This function doesn't return if it uses E_ERROR */ -ZEND_API ZEND_COLD int zend_exception_error(zend_object *ex, int severity) /* {{{ */ +ZEND_API ZEND_COLD ZEND_RESULT_CODE zend_exception_error(zend_object *ex, int severity) /* {{{ */ { zval exception, rv; zend_class_entry *ce_exception; - int result = FAILURE; + ZEND_RESULT_CODE result = FAILURE; ZVAL_OBJ(&exception, ex); ce_exception = ex->ce; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 7e8c73b1e920a..78eff15a40e12 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -67,7 +67,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, extern ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); /* show an exception using zend_error(severity,...), severity should be E_ERROR */ -ZEND_API ZEND_COLD int zend_exception_error(zend_object *exception, int severity); +ZEND_API ZEND_COLD ZEND_RESULT_CODE zend_exception_error(zend_object *exception, int severity); ZEND_API ZEND_COLD void zend_throw_unwind_exit(void); ZEND_API zend_bool zend_is_unwind_exit(zend_object *ex); From efef6f7fe4e4604345e7716416181f1ea4cb4669 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 23:51:42 +0200 Subject: [PATCH 13/65] Voidify zend_execute.c --- Zend/zend_execute.c | 39 ++++++++++++++++++--------------------- Zend/zend_execute.h | 10 +++++----- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 601b5221eef2c..0574c6196f60e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1225,11 +1225,10 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret) } #endif -static ZEND_COLD int zend_verify_missing_return_type(const zend_function *zf, void **cache_slot) +static ZEND_COLD void zend_verify_missing_return_type(const zend_function *zf, void **cache_slot) { /* VERIFY_RETURN_TYPE is not emitted for "void" functions, so this is always an error. */ zend_verify_return_error(zf, cache_slot, NULL); - return 0; } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(void) @@ -1900,7 +1899,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_index(const zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset)); } -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) +ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -1918,7 +1917,7 @@ ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, return SUCCESS; } -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) +ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -2307,7 +2306,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC); } -static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int is_list, int slow EXECUTE_DATA_DC) +static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, bool is_list, int slow EXECUTE_DATA_DC) { zval *retval; @@ -2482,7 +2481,7 @@ static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable } } -static zend_never_inline int ZEND_FASTCALL zend_isset_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) +static zend_never_inline bool ZEND_FASTCALL zend_isset_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) { if (/*OP2_TYPE == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) { offset = ZVAL_UNDEFINED_OP2(); @@ -2521,7 +2520,7 @@ static zend_never_inline int ZEND_FASTCALL zend_isset_dim_slow(zval *container, } } -static zend_never_inline int ZEND_FASTCALL zend_isempty_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) +static zend_never_inline bool ZEND_FASTCALL zend_isempty_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) { if (/*OP2_TYPE == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) { offset = ZVAL_UNDEFINED_OP2(); @@ -2890,7 +2889,7 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co OPLINE_CC EXECUTE_DATA_CC); } -static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { +static zend_never_inline ZEND_RESULT_CODE zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { zend_string *name; zend_class_entry *ce; zend_property_info *property_info; @@ -2968,8 +2967,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval } -static zend_always_inline int zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { - int success; +static zend_always_inline ZEND_RESULT_CODE zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { zend_property_info *property_info; if (opline->op1_type == IS_CONST && (opline->op2_type == IS_CONST || (opline->op2_type == IS_UNUSED && (opline->op2.num == ZEND_FETCH_CLASS_SELF || opline->op2.num == ZEND_FETCH_CLASS_PARENT))) && EXPECTED(CACHED_PTR(cache_slot) != NULL)) { @@ -2985,6 +2983,7 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval, return FAILURE; } } else { + ZEND_RESULT_CODE success; success = zend_fetch_static_property_address_ex(retval, &property_info, cache_slot, fetch_type OPLINE_CC EXECUTE_DATA_CC); if (UNEXPECTED(success != SUCCESS)) { return FAILURE; @@ -3046,7 +3045,7 @@ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info } /* 1: valid, 0: invalid, -1: may be valid after type coercion */ -static zend_always_inline int i_zend_verify_type_assignable_zval( +static zend_always_inline bool i_zend_verify_type_assignable_zval( zend_property_info *info, zval *zv, zend_bool strict) { zend_type type = info->type; uint32_t type_mask; @@ -3347,7 +3346,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_clone_call(zend zend_hash_apply(EX(symbol_table), zend_check_symbol); \ } -static int zend_check_symbol(zval *pz) +static void zend_check_symbol(zval *pz) { if (Z_TYPE_P(pz) == IS_INDIRECT) { pz = Z_INDIRECT_P(pz); @@ -3364,8 +3363,6 @@ static int zend_check_symbol(zval *pz) /* OBJ-TBI - doesn't support new object model! */ zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol); } - - return 0; } @@ -4285,8 +4282,8 @@ static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *ar } /* }}} */ -static zend_always_inline int _zend_quick_get_constant( - const zval *key, uint32_t flags, int check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE _zend_quick_get_constant( + const zval *key, uint32_t flags, bool check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { zval *zv; zend_constant *c = NULL; @@ -4330,7 +4327,7 @@ static zend_never_inline void ZEND_FASTCALL zend_quick_get_constant( _zend_quick_get_constant(key, flags, 0 OPLINE_CC EXECUTE_DATA_CC); } /* }}} */ -static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant( +static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL zend_quick_check_constant( const zval *key OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { return _zend_quick_get_constant(key, 0, 1 OPLINE_CC EXECUTE_DATA_CC); @@ -4453,7 +4450,7 @@ static void end_fake_frame(zend_execute_data *call) { } } -ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { zend_function *fbc = call->func; if (fbc->type == ZEND_USER_FUNCTION) { uint32_t num_args = ZEND_CALL_NUM_ARGS(call); @@ -4481,7 +4478,7 @@ ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { zval tmp; ZVAL_COPY(&tmp, default_value); start_fake_frame(call, opline); - int ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); + ZEND_RESULT_CODE ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); end_fake_frame(call); if (UNEXPECTED(ret == FAILURE)) { zval_ptr_dtor_nogc(&tmp); @@ -4536,7 +4533,7 @@ ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { if (Z_TYPE(default_value) == IS_CONSTANT_AST) { start_fake_frame(call, NULL); - int ret = zval_update_constant_ex(&default_value, fbc->common.scope); + ZEND_RESULT_CODE ret = zval_update_constant_ex(&default_value, fbc->common.scope); end_fake_frame(call); if (ret == FAILURE) { return FAILURE; @@ -4753,7 +4750,7 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint #include "zend_vm_execute.h" -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) +ZEND_API ZEND_RESULT_CODE zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) { if (opcode != ZEND_USER_OPCODE) { if (handler == NULL) { diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index f93a9f5e0e86a..dde45907ff3fd 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -64,8 +64,8 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv); ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv); -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); +ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); +ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg); ZEND_API ZEND_COLD void zend_verify_arg_error( @@ -155,8 +155,8 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval return variable_ptr; } -ZEND_API int zval_update_constant(zval *pp); -ZEND_API int zval_update_constant_ex(zval *pp, zend_class_entry *scope); +ZEND_API ZEND_RESULT_CODE zval_update_constant(zval *pp); +ZEND_API ZEND_RESULT_CODE zval_update_constant_ex(zval *pp, zend_class_entry *scope); /* dedicated Zend executor functions - do not use! */ struct _zend_vm_stack { @@ -317,7 +317,7 @@ ZEND_API uint32_t zend_get_executed_lineno(void); ZEND_API zend_class_entry *zend_get_executed_scope(void); ZEND_API zend_bool zend_is_executing(void); -ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals); +ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals); ZEND_API void zend_unset_timeout(void); ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void); ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type); From ef1fe7715d26850279fe6600885221890e8c6fe9 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 15 Aug 2020 23:50:43 +0200 Subject: [PATCH 14/65] Boolify zend_execute.c --- Zend/zend_execute.c | 12 ++++++------ Zend/zend_execute.h | 8 ++++---- Zend/zend_execute_API.c | 34 +++++++++++++++++----------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0574c6196f60e..8f69f0a0f08a9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -568,7 +568,7 @@ static zend_never_inline zval* zend_assign_to_typed_property_reference(zend_prop return prop; } -static zend_never_inline ZEND_COLD int zend_wrong_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC) +static zend_never_inline ZEND_COLD bool zend_wrong_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC) { zend_error(E_NOTICE, "Only variables should be assigned by reference"); if (UNEXPECTED(EG(exception) != NULL)) { @@ -1035,7 +1035,7 @@ static zend_always_inline zend_bool zend_check_type( return zend_check_type_slow(type, arg, ref, cache_slot, scope, is_return_type, is_internal); } -static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot) +static zend_always_inline bool zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot) { zend_arg_info *cur_arg_info; @@ -1051,7 +1051,7 @@ static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint3 return 1; } -static zend_always_inline int zend_verify_variadic_arg_type( +static zend_always_inline bool zend_verify_variadic_arg_type( zend_function *zf, zend_arg_info *arg_info, uint32_t arg_num, zval *arg, void **cache_slot) { ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type)); @@ -1063,7 +1063,7 @@ static zend_always_inline int zend_verify_variadic_arg_type( return 1; } -static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call) +static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call) { uint32_t i; uint32_t num_args = ZEND_CALL_NUM_ARGS(call); @@ -1203,7 +1203,7 @@ static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, con fclass, fsep, fname, returned_msg, returned_kind); } -static int zend_verify_internal_return_type(zend_function *zf, zval *ret) +static bool zend_verify_internal_return_type(zend_function *zf, zval *ret) { zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1; void *dummy_cache_slot = NULL; @@ -3045,7 +3045,7 @@ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info } /* 1: valid, 0: invalid, -1: may be valid after type coercion */ -static zend_always_inline bool i_zend_verify_type_assignable_zval( +static zend_always_inline int i_zend_verify_type_assignable_zval( zend_property_info *info, zval *zv, zend_bool strict) { zend_type type = info->type; uint32_t type_mask; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index dde45907ff3fd..9d94992586f3a 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -47,10 +47,10 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name); ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags); ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex); ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex); -ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); -ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); -ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions); -ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions); +ZEND_API ZEND_RESULT_CODE zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); +ZEND_API ZEND_RESULT_CODE zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); +ZEND_API ZEND_RESULT_CODE zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions); +ZEND_API ZEND_RESULT_CODE zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions); /* export zend_pass_function to allow comparisons against it */ extern ZEND_API const zend_internal_function zend_pass_function; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 0e721c451e9a6..3c642da21a166 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -585,7 +585,7 @@ ZEND_API zend_bool zend_is_executing(void) /* {{{ */ } /* }}} */ -ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ { if (Z_TYPE_P(p) == IS_CONSTANT_AST) { zend_ast *ast = Z_ASTVAL_P(p); @@ -613,13 +613,13 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ } /* }}} */ -ZEND_API int zval_update_constant(zval *pp) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zval_update_constant(zval *pp) /* {{{ */ { return zval_update_constant_ex(pp, EG(current_execute_data) ? zend_get_executed_scope() : CG(active_class_entry)); } /* }}} */ -int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ +ZEND_RESULT_CODE _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ { zend_fcall_info fci; @@ -635,7 +635,7 @@ int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr } /* }}} */ -int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ +ZEND_RESULT_CODE zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ { uint32_t i; zend_execute_data *call, dummy_execute_data; @@ -956,7 +956,7 @@ ZEND_API void zend_call_known_function( fcic.object = object; fcic.called_scope = called_scope; - int result = zend_call_function(&fci, &fcic); + ZEND_RESULT_CODE result = zend_call_function(&fci, &fcic); if (UNEXPECTED(result == FAILURE)) { if (!EG(exception)) { zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", @@ -1134,12 +1134,12 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */ } /* }}} */ -ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ { zval pv; zend_op_array *new_op_array; uint32_t original_compiler_options; - int retval; + ZEND_RESULT_CODE retval; if (retval_ptr) { ZVAL_NEW_STR(&pv, zend_string_alloc(str_len + sizeof("return ;")-1, 0)); @@ -1198,15 +1198,15 @@ ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr } /* }}} */ -ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ { return zend_eval_stringl(str, strlen(str), retval_ptr, string_name); } /* }}} */ -ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { - int result; + ZEND_RESULT_CODE result; result = zend_eval_stringl(str, str_len, retval_ptr, string_name); if (handle_exceptions && EG(exception)) { @@ -1216,13 +1216,13 @@ ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ } /* }}} */ -ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions); } /* }}} */ -static void zend_set_timeout_ex(zend_long seconds, int reset_signals); +static void zend_set_timeout_ex(zend_long seconds, bool reset_signals); ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void) /* {{{ */ { @@ -1322,7 +1322,7 @@ VOID CALLBACK tq_timer_cb(PVOID arg, BOOLEAN timed_out) #define SIGPROF 27 #endif -static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */ +static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ { #ifdef ZEND_WIN32 zend_executor_globals *eg; @@ -1394,7 +1394,7 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */ } /* }}} */ -void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */ +void zend_set_timeout(zend_long seconds, bool reset_signals) /* {{{ */ { EG(timeout_seconds) = seconds; @@ -1525,7 +1525,7 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string } /* }}} */ -ZEND_API int zend_delete_global_variable(zend_string *name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_delete_global_variable(zend_string *name) /* {{{ */ { return zend_hash_del_ind(&EG(symbol_table), name); } @@ -1638,7 +1638,7 @@ ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ * } /* }}} */ -ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_set_local_var(zend_string *name, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); @@ -1681,7 +1681,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{ } /* }}} */ -ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_set_local_var_str(const char *name, size_t len, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); From 914125777292b052fa92fd860eadb2c0dc525eab Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:08:07 +0200 Subject: [PATCH 15/65] Drop zend_handle_sigsegv() unused var --- Zend/zend_execute_API.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 3c642da21a166..9059ce61841f2 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -56,7 +56,7 @@ ZEND_TLS HANDLE tq_timer = NULL; #if 0&&ZEND_DEBUG static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) /* {{{ */ +static void zend_handle_sigsegv(void) /* {{{ */ { fflush(stdout); fflush(stderr); From 7f478fd7b17d1b9079378ed8ff404a595304ab26 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:10:12 +0200 Subject: [PATCH 16/65] Boolify zend_extensions.c --- Zend/zend_extensions.c | 6 +++--- Zend/zend_extensions.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 2509daf3180c5..9c05c840033ab 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -24,7 +24,7 @@ ZEND_API uint32_t zend_extension_flags = 0; ZEND_API int zend_op_array_extension_handles = 0; static int last_resource_number; -int zend_load_extension(const char *path) +ZEND_RESULT_CODE zend_load_extension(const char *path) { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; @@ -51,7 +51,7 @@ int zend_load_extension(const char *path) #endif } -int zend_load_extension_handle(DL_HANDLE handle, const char *path) +ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path) { #if ZEND_EXTENSIONS_SUPPORT zend_extension *new_extension; @@ -181,7 +181,7 @@ static void zend_extension_shutdown(zend_extension *extension) #endif } -static int zend_extension_startup(zend_extension *extension) +static bool zend_extension_startup(zend_extension *extension) { #if ZEND_EXTENSIONS_SUPPORT if (extension->startup) { diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 59cd970b3a063..21a94a710da98 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -141,12 +141,12 @@ ZEND_API extern uint32_t zend_extension_flags; void zend_extension_dtor(zend_extension *extension); ZEND_API void zend_append_version_info(const zend_extension *extension); int zend_startup_extensions_mechanism(void); -int zend_startup_extensions(void); +bool zend_startup_extensions(void); void zend_shutdown_extensions(void); BEGIN_EXTERN_C() -ZEND_API int zend_load_extension(const char *path); -ZEND_API int zend_load_extension_handle(DL_HANDLE handle, const char *path); +ZEND_API ZEND_RESULT_CODE zend_load_extension(const char *path); +ZEND_API ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path); ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); ZEND_API zend_extension *zend_get_extension(const char *extension_name); ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array); From 700448cc511aa5d079d8b24d44721b46412d02fe Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:11:03 +0200 Subject: [PATCH 17/65] Voidify zend_extensions.c --- Zend/zend_extensions.c | 10 +++------- Zend/zend_extensions.h | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 9c05c840033ab..9c3d5cc631e0c 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -138,7 +138,7 @@ ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path) } -int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) +void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) { #if ZEND_EXTENSIONS_SUPPORT zend_extension extension; @@ -167,8 +167,6 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) } /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/ #endif - - return SUCCESS; } @@ -195,20 +193,18 @@ static bool zend_extension_startup(zend_extension *extension) } -int zend_startup_extensions_mechanism() +void zend_startup_extensions_mechanism() { /* Startup extensions mechanism */ zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1); zend_op_array_extension_handles = 0; last_resource_number = 0; - return SUCCESS; } -int zend_startup_extensions() +void zend_startup_extensions() { zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup); - return SUCCESS; } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 21a94a710da98..ce72a80953646 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -140,14 +140,14 @@ ZEND_API extern uint32_t zend_extension_flags; void zend_extension_dtor(zend_extension *extension); ZEND_API void zend_append_version_info(const zend_extension *extension); -int zend_startup_extensions_mechanism(void); +void zend_startup_extensions_mechanism(void); bool zend_startup_extensions(void); void zend_shutdown_extensions(void); BEGIN_EXTERN_C() ZEND_API ZEND_RESULT_CODE zend_load_extension(const char *path); ZEND_API ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path); -ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); +ZEND_API void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); ZEND_API zend_extension *zend_get_extension(const char *extension_name); ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array); ZEND_API size_t zend_extensions_op_array_persist(zend_op_array *op_array, void *mem); From b7d5d01b846559b71a88c40826132a8c545df0f2 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 15:27:50 +0200 Subject: [PATCH 18/65] Fix zend_extension --- Zend/zend_extensions.c | 3 ++- Zend/zend_extensions.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 9c3d5cc631e0c..8ea36e081282f 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -126,7 +126,8 @@ ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path) return FAILURE; } - return zend_register_extension(new_extension, handle); + zend_register_extension(new_extension, handle); + return SUCCESS; #else fprintf(stderr, "Extensions are not supported on this platform.\n"); /* See http://support.microsoft.com/kb/190351 */ diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index ce72a80953646..02fd3bb6dc51a 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -141,7 +141,7 @@ ZEND_API extern uint32_t zend_extension_flags; void zend_extension_dtor(zend_extension *extension); ZEND_API void zend_append_version_info(const zend_extension *extension); void zend_startup_extensions_mechanism(void); -bool zend_startup_extensions(void); +void zend_startup_extensions(void); void zend_shutdown_extensions(void); BEGIN_EXTERN_C() From abcb59a35742f0562d5399ee7e6beef98a9b0358 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:14:45 +0200 Subject: [PATCH 19/65] Boolify zend_gdb.c --- Zend/zend_gdb.c | 6 +++--- Zend/zend_gdb.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c index 0fff7420486ff..ce6dc6a7850f9 100644 --- a/Zend/zend_gdb.c +++ b/Zend/zend_gdb.c @@ -54,7 +54,7 @@ ZEND_API zend_never_inline void __jit_debug_register_code() __asm__ __volatile__(""); } -ZEND_API int zend_gdb_register_code(const void *object, size_t size) +ZEND_API bool zend_gdb_register_code(const void *object, size_t size) { zend_gdbjit_code_entry *entry; @@ -102,9 +102,9 @@ ZEND_API void zend_gdb_unregister_all(void) } } -ZEND_API int zend_gdb_present(void) +ZEND_API bool zend_gdb_present(void) { - int ret = 0; + bool ret = 0; int fd = open("/proc/self/status", O_RDONLY); if (fd > 0) { diff --git a/Zend/zend_gdb.h b/Zend/zend_gdb.h index 220b70888fc80..aad0fefb097b9 100644 --- a/Zend/zend_gdb.h +++ b/Zend/zend_gdb.h @@ -20,8 +20,8 @@ #ifndef ZEND_GDB #define ZEND_GDB -ZEND_API int zend_gdb_register_code(const void *object, size_t size); +ZEND_API bool zend_gdb_register_code(const void *object, size_t size); ZEND_API void zend_gdb_unregister_all(void); -ZEND_API int zend_gdb_present(void); +ZEND_API bool zend_gdb_present(void); #endif From 5d70fe827c499bddfda007bfda53c28eb9b934b5 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:15:43 +0200 Subject: [PATCH 20/65] Boolify zend_generator.c --- Zend/zend_generators.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 040a213ce7491..f9a8fb4c09b2f 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -629,7 +629,7 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator return root; } -static int zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ +static ZEND_RESULT_CODE zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ { zval *value; if (Z_TYPE(generator->values) == IS_ARRAY) { @@ -1027,7 +1027,7 @@ static void zend_generator_iterator_dtor(zend_object_iterator *iterator) /* {{{ } /* }}} */ -static int zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */ +static ZEND_RESULT_CODE zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */ { zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data); @@ -1106,6 +1106,7 @@ static const zend_object_iterator_funcs zend_generator_iterator_functions = { zend_generator_iterator_get_gc, }; +/* by_ref is int due to Iterator API */ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */ { zend_object_iterator *iterator; From d70cbafd443b3c3846a3c5c8e527eea5700ae7d2 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:23:44 +0200 Subject: [PATCH 21/65] Boolify zend_hash.c --- Zend/zend_hash.c | 24 ++++++++++++------------ Zend/zend_hash.h | 6 +++--- Zend/zend_ts_hash.c | 12 ++++++------ Zend/zend_ts_hash.h | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 365cf892beed8..5779a079232f1 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -218,7 +218,7 @@ static zend_always_inline void zend_hash_real_init_mixed_ex(HashTable *ht) HT_HASH_RESET(ht); } -static zend_always_inline void zend_hash_real_init_ex(HashTable *ht, int packed) +static zend_always_inline void zend_hash_real_init_ex(HashTable *ht, bool packed) { HT_ASSERT_RC1(ht); ZEND_ASSERT(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED); @@ -1360,7 +1360,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p) _zend_hash_del_el(ht, HT_IDX_TO_HASH(p - ht->arData), p); } -ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1390,7 +1390,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1438,7 +1438,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1482,7 +1482,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1512,7 +1512,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, siz return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) { uint32_t nIndex; uint32_t idx; @@ -1964,7 +1964,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, } -static zend_always_inline int zend_array_dup_element(HashTable *source, HashTable *target, uint32_t idx, Bucket *p, Bucket *q, int packed, int static_keys, int with_holes) +static zend_always_inline bool zend_array_dup_element(HashTable *source, HashTable *target, uint32_t idx, Bucket *p, Bucket *q, bool packed, bool static_keys, bool with_holes) { zval *data = &p->val; @@ -2018,7 +2018,7 @@ static zend_always_inline int zend_array_dup_element(HashTable *source, HashTabl return 1; } -static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, HashTable *target, int with_holes) +static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, HashTable *target, bool with_holes) { Bucket *p = source->arData; Bucket *q = target->arData; @@ -2034,7 +2034,7 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, } while (p != end); } -static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, int static_keys, int with_holes) +static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, bool static_keys, bool with_holes) { uint32_t idx = 0; Bucket *p = source->arData; @@ -2325,7 +2325,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Has } -ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) { uint32_t idx; @@ -2350,7 +2350,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition } } -ZEND_API int ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) { uint32_t idx = *pos; @@ -2707,7 +2707,7 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, bucket_compar return &res->val; } -ZEND_API int ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx) +ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx) { register const char *tmp = key; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 2dc4723978ddd..bbd5205db3a9d 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -508,7 +508,7 @@ static zend_always_inline zval *zend_symtable_find_ind(const HashTable *ht, zend } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_exists(HashTable *ht, zend_string *key) +static zend_always_inline bool zend_symtable_exists(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -520,7 +520,7 @@ static zend_always_inline ZEND_RESULT_CODE zend_symtable_exists(HashTable *ht, z } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_exists_ind(HashTable *ht, zend_string *key) +static zend_always_inline bool zend_symtable_exists_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -592,7 +592,7 @@ static zend_always_inline zval *zend_symtable_str_find(HashTable *ht, const char } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) +static zend_always_inline bool zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) { zend_ulong idx; diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index daa9aafefaef0..425ee7d13289e 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -186,9 +186,9 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun end_write(ht); } -ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key) +ZEND_API ZEND_RESULT_CODE zend_ts_hash_del(TsHashTable *ht, zend_string *key) { - int retval; + ZEND_RESULT_CODE retval; begin_write(ht); retval = zend_hash_del(TS_HASH(ht), key); @@ -197,9 +197,9 @@ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) +ZEND_API ZEND_RESULT_CODE zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) { - int retval; + ZEND_RESULT_CODE retval; begin_write(ht); retval = zend_hash_index_del(TS_HASH(ht), h); @@ -246,7 +246,7 @@ ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, end_read(source); } -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite) +ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, bool overwrite) { begin_read(source); begin_write(target); @@ -264,7 +264,7 @@ ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, co end_read(source); } -ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, int renumber) +ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber) { begin_write(ht); zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber); diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 3f245d21206e4..2f4e5575f19dd 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -56,8 +56,8 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun /* Deletes */ -ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key); -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); +ZEND_API ZEND_RESULT_CODE zend_ts_hash_del(TsHashTable *ht, zend_string *key); +ZEND_API ZEND_RESULT_CODE zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); /* Data retrieval */ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key); @@ -66,10 +66,10 @@ ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong); /* Copying, merging and sorting */ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite); +ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, bool overwrite); ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam); -ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, int renumber); -ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered); +ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber); +ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered); ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, bucket_compare_func_t compar, int flag); ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht); @@ -112,12 +112,12 @@ static zend_always_inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const return zv ? Z_PTR_P(zv) : NULL; } -static zend_always_inline int zend_ts_hash_exists(TsHashTable *ht, zend_string *key) +static zend_always_inline bool zend_ts_hash_exists(TsHashTable *ht, zend_string *key) { return zend_ts_hash_find(ht, key) != NULL; } -static zend_always_inline int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h) +static zend_always_inline bool zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h) { return zend_ts_hash_index_find(ht, h) != NULL; } From 2f7ed868ab3cae5c70ce2880d86dfad59204cdf7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:43:46 +0200 Subject: [PATCH 22/65] Boolify zend_highlight.c --- Zend/zend_highlight.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 8ea1518ca662f..99bacd19b4377 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -39,8 +39,8 @@ typedef struct _zend_syntax_highlighter_ini { BEGIN_EXTERN_C() ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini); ZEND_API void zend_strip(void); -ZEND_API int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); -ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); +ZEND_API ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); +ZEND_API ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); ZEND_API void zend_html_putc(char c); ZEND_API void zend_html_puts(const char *s, size_t len); END_EXTERN_C() From 71b5d1b127f4d91ca2594e96330edd86c5cc0d6a Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:45:10 +0200 Subject: [PATCH 23/65] Boolify zend_inheritence.c --- Zend/zend_inheritance.c | 4 ++-- Zend/zend_inheritance.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 158b67ce38007..3054bd162135f 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -633,7 +633,7 @@ static inheritance_status zend_do_perform_implementation_check( /* }}} */ static ZEND_COLD void zend_append_type_hint( - smart_str *str, zend_class_entry *scope, zend_arg_info *arg_info, int return_hint) /* {{{ */ + smart_str *str, zend_class_entry *scope, zend_arg_info *arg_info, bool return_hint) /* {{{ */ { if (ZEND_TYPE_IS_SET(arg_info->type)) { zend_string *type_str = zend_type_to_string_resolved(arg_info->type, scope); @@ -2390,7 +2390,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) { } } -ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ { /* Load parent/interface dependencies first, so we can still gracefully abort linking * with an exception and remove the class from the class table. This is only possible diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index 6cf2d1b78d874..067519c5f2347 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -30,7 +30,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par #define zend_do_inheritance(ce, parent_ce) \ zend_do_inheritance_ex(ce, parent_ce, 0) -ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); +ZEND_API ZEND_RESULT_CODE zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); void zend_verify_abstract_class(zend_class_entry *ce); void zend_build_properties_info_table(zend_class_entry *ce); From 315d298186f909f8a3cb118083a6cea17d1bdded Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:46:09 +0200 Subject: [PATCH 24/65] Boolify zend_ini.c --- Zend/zend_ini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 488468f0e0331..bfa8eebf7f339 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -41,9 +41,9 @@ static int zend_remove_ini_entries(zval *el, void *arg) /* {{{ */ } /* }}} */ -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ +static ZEND_RESULT_CODE zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ { - int result = FAILURE; + ZEND_RESULT_CODE result = FAILURE; if (ini_entry->modified) { if (ini_entry->on_modify) { From ce33408df4aedeb065712c9c7ca9b48e2d283558 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:47:41 +0200 Subject: [PATCH 25/65] Voidify zend_ini.c --- Zend/zend_ini.c | 33 ++++++++++++++------------------- Zend/zend_ini.h | 24 ++++++++++++------------ Zend/zend_ini_parser.y | 4 ++-- Zend/zend_ini_scanner.h | 4 ++-- Zend/zend_ini_scanner.l | 8 ++++---- 5 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index bfa8eebf7f339..0f4970a28909d 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -89,7 +89,7 @@ static void free_ini_entry(zval *zv) /* {{{ */ /* * Startup / shutdown */ -ZEND_API int zend_ini_startup(void) /* {{{ */ +ZEND_API void zend_ini_startup(void) /* {{{ */ { registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); @@ -97,14 +97,12 @@ ZEND_API int zend_ini_startup(void) /* {{{ */ EG(modified_ini_directives) = NULL; EG(error_reporting_ini_entry) = NULL; zend_hash_init(registered_zend_ini_directives, 128, NULL, free_ini_entry, 1); - return SUCCESS; } /* }}} */ -ZEND_API int zend_ini_shutdown(void) /* {{{ */ +ZEND_API void zend_ini_shutdown(void) /* {{{ */ { zend_ini_dtor(EG(ini_directives)); - return SUCCESS; } /* }}} */ @@ -115,15 +113,14 @@ ZEND_API void zend_ini_dtor(HashTable *ini_directives) /* {{{ */ } /* }}} */ -ZEND_API int zend_ini_global_shutdown(void) /* {{{ */ +ZEND_API void zend_ini_global_shutdown(void) /* {{{ */ { zend_hash_destroy(registered_zend_ini_directives); free(registered_zend_ini_directives); - return SUCCESS; } /* }}} */ -ZEND_API int zend_ini_deactivate(void) /* {{{ */ +ZEND_API void zend_ini_deactivate(void) /* {{{ */ { if (EG(modified_ini_directives)) { zend_ini_entry *ini_entry; @@ -135,7 +132,6 @@ ZEND_API int zend_ini_deactivate(void) /* {{{ */ FREE_HASHTABLE(EG(modified_ini_directives)); EG(modified_ini_directives) = NULL; } - return SUCCESS; } /* }}} */ @@ -159,14 +155,13 @@ static void copy_ini_entry(zval *zv) /* {{{ */ } /* }}} */ -ZEND_API int zend_copy_ini_directives(void) /* {{{ */ +ZEND_API void zend_copy_ini_directives(void) /* {{{ */ { EG(modified_ini_directives) = NULL; EG(error_reporting_ini_entry) = NULL; EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, free_ini_entry, 1); zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, copy_ini_entry); - return SUCCESS; } /* }}} */ #endif @@ -199,7 +194,7 @@ ZEND_API void zend_ini_sort_entries(void) /* {{{ */ /* * Registration / unregistration */ -ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ { zend_ini_entry *p; zval *default_value; @@ -280,16 +275,16 @@ ZEND_API void zend_ini_refresh_caches(int stage) /* {{{ */ /* }}} */ #endif -ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ { return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0); } /* }}} */ -ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ { - int ret; + ZEND_RESULT_CODE ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -299,9 +294,9 @@ ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, si } /* }}} */ -ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ { - int ret; + ZEND_RESULT_CODE ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -311,7 +306,7 @@ ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, } /* }}} */ -ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change) /* {{{ */ { zend_ini_entry *ini_entry; zend_string *duplicate; @@ -363,7 +358,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, } /* }}} */ -ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ { zend_ini_entry *ini_entry; @@ -384,7 +379,7 @@ ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ } /* }}} */ -ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 0289b322be1a2..99378298b2671 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -61,24 +61,24 @@ struct _zend_ini_entry { }; BEGIN_EXTERN_C() -ZEND_API int zend_ini_startup(void); -ZEND_API int zend_ini_shutdown(void); -ZEND_API int zend_ini_global_shutdown(void); -ZEND_API int zend_ini_deactivate(void); +ZEND_API void zend_ini_startup(void); +ZEND_API void zend_ini_shutdown(void); +ZEND_API void zend_ini_global_shutdown(void); +ZEND_API void zend_ini_deactivate(void); ZEND_API void zend_ini_dtor(HashTable *ini_directives); -ZEND_API int zend_copy_ini_directives(void); +ZEND_API void zend_copy_ini_directives(void); ZEND_API void zend_ini_sort_entries(void); -ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); +ZEND_API ZEND_RESULT_CODE zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); ZEND_API void zend_unregister_ini_entries(int module_number); ZEND_API void zend_ini_refresh_caches(int stage); -ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change); -ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); -ZEND_API int zend_restore_ini_entry(zend_string *name, int stage); +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change); +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); +ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); +ZEND_API ZEND_RESULT_CODE zend_restore_ini_entry(zend_string *name, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig); @@ -88,7 +88,7 @@ ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig ZEND_API zend_string *zend_ini_get_value(zend_string *name); ZEND_API zend_bool zend_ini_parse_bool(zend_string *str); -ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); +ZEND_API ZEND_RESULT_CODE zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 373dee7aeb16d..c65485d6f1933 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -212,7 +212,7 @@ static ZEND_COLD void ini_error(const char *msg) /* }}} */ /* {{{ zend_parse_ini_file() */ -ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API ZEND_RESULT_CODE zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; @@ -240,7 +240,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro /* }}} */ /* {{{ zend_parse_ini_string() */ -ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API ZEND_RESULT_CODE zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index ddb9247d3721d..6d5d2f5062b01 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -28,8 +28,8 @@ BEGIN_EXTERN_C() ZEND_COLD int zend_ini_scanner_get_lineno(void); ZEND_COLD char *zend_ini_scanner_get_filename(void); -int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); -int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); +ZEND_RESULT_CODE zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); +ZEND_RESULT_CODE zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); int ini_lex(zval *ini_lval); void shutdown_ini_scanner(void); END_EXTERN_C() diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index c8efb1f144d95..8324526419f12 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -151,7 +151,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; return type; \ } -static inline int convert_to_number(zval *retval, const char *str, const int str_len) +static inline ZEND_RESULT_CODE convert_to_number(zval *retval, const char *str, const int str_len) { zend_uchar type; int overflow; @@ -218,7 +218,7 @@ static void yy_scan_buffer(char *str, unsigned int len) #define ini_filename SCNG(filename) /* {{{ init_ini_scanner() */ -static int init_ini_scanner(int scanner_mode, zend_file_handle *fh) +static ZEND_RESULT_CODE init_ini_scanner(int scanner_mode, zend_file_handle *fh) { /* Sanity check */ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) { @@ -268,7 +268,7 @@ ZEND_COLD char *zend_ini_scanner_get_filename(void) /* }}} */ /* {{{ zend_ini_open_file_for_scanning() */ -int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) +ZEND_RESULT_CODE zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) { char *buf; size_t size; @@ -289,7 +289,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) /* }}} */ /* {{{ zend_ini_prepare_string_for_scanning() */ -int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) +ZEND_RESULT_CODE zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) { int len = (int)strlen(str); From 801605f8521df37b2d0fa2b18ab852183622f221 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 15:05:15 +0200 Subject: [PATCH 26/65] Fix zend.c after voidification of zend_copy_ini_directives() --- Zend/zend.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 34de8ff88ec13..354b9c3c5ea16 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -757,9 +757,8 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{ static void zend_new_thread_end_handler(THREAD_T thread_id) /* {{{ */ { - if (zend_copy_ini_directives() == SUCCESS) { - zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP); - } + zend_copy_ini_directives(); + zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP); } /* }}} */ #endif From 8d365469582781202df859ed7ded54bf89d98948 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 00:56:22 +0200 Subject: [PATCH 27/65] Boolify zend_interface.c --- Zend/zend_interfaces.c | 28 +++++++++++++++------------- Zend/zend_interfaces.h | 12 ++++++------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 808de7c170dac..280af1cc3c41f 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -118,13 +118,13 @@ static void zend_user_it_dtor(zend_object_iterator *_iter) /* }}} */ /* {{{ zend_user_it_valid */ -ZEND_API int zend_user_it_valid(zend_object_iterator *_iter) +ZEND_API ZEND_RESULT_CODE zend_user_it_valid(zend_object_iterator *_iter) { if (_iter) { zend_user_iterator *iter = (zend_user_iterator*)_iter; zval *object = &iter->it.data; zval more; - int result; + bool result; zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more); result = i_zend_is_true(&more); @@ -203,6 +203,7 @@ static const zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = }; /* {{{ zend_user_it_get_iterator */ +/* by_ref is int due to Iterator API */ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object, int by_ref) { zend_user_iterator *iterator; @@ -225,6 +226,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva /* }}} */ /* {{{ zend_user_it_get_new_iterator */ +/* by_ref is int due to Iterator API */ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref) { zval iterator; @@ -249,7 +251,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c /* }}} */ /* {{{ zend_implement_traversable */ -static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) +static ZEND_RESULT_CODE zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) { /* Abstract class can implement Traversable only, in which case the extending class must * implement Iterator or IteratorAggregate. */ @@ -276,7 +278,7 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en /* }}} */ /* {{{ zend_implement_aggregate */ -static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) +static ZEND_RESULT_CODE zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_iterator)) { zend_error_noreturn(E_ERROR, @@ -316,7 +318,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr /* }}} */ /* {{{ zend_implement_iterator */ -static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) +static ZEND_RESULT_CODE zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_aggregate)) { zend_error_noreturn(E_ERROR, @@ -352,11 +354,11 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry /* }}} */ /* {{{ zend_user_serialize */ -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) +ZEND_API ZEND_RESULT_CODE zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) { zend_class_entry * ce = Z_OBJCE_P(object); zval retval; - int result; + ZEND_RESULT_CODE result; zend_call_method_with_0_params( Z_OBJ_P(object), Z_OBJCE_P(object), NULL, "serialize", &retval); @@ -389,7 +391,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b /* }}} */ /* {{{ zend_user_unserialize */ -ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) +ZEND_API ZEND_RESULT_CODE zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) { zval zdata; @@ -410,7 +412,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns } /* }}} */ -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ZSTR_VAL(ce->name)); @@ -418,7 +420,7 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, siz } /* }}} */ -ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ { zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ZSTR_VAL(ce->name)); return FAILURE; @@ -426,7 +428,7 @@ ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, con /* }}} */ /* {{{ zend_implement_serializable */ -static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static ZEND_RESULT_CODE zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->parent && (class_type->parent->serialize || class_type->parent->unserialize) @@ -458,7 +460,7 @@ static zend_object *zend_internal_iterator_create(zend_class_entry *ce) { return &intern->std; } -ZEND_API int zend_create_internal_iterator_zval(zval *return_value, zval *obj) { +ZEND_API ZEND_RESULT_CODE zend_create_internal_iterator_zval(zval *return_value, zval *obj) { zend_class_entry *scope = EG(current_execute_data)->func->common.scope; ZEND_ASSERT(scope->get_iterator != zend_user_it_get_new_iterator); zend_object_iterator *iter = scope->get_iterator(Z_OBJCE_P(obj), obj, /* by_ref */ 0); @@ -492,7 +494,7 @@ static zend_internal_iterator *zend_internal_iterator_fetch(zval *This) { } /* Many iterators will not behave correctly if rewind() is not called, make sure it happens. */ -static int zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { +static ZEND_RESULT_CODE zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { if (!intern->rewind_called) { zend_object_iterator *iter = intern->iter; intern->rewind_called = 1; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 3f3f39b0877f4..bbc4ac5b49fda 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -61,7 +61,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z zend_class_implements(zend_ce_ ## class_name, 1, zend_ce_ ## interface_name) ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter); -ZEND_API int zend_user_it_valid(zend_object_iterator *_iter); +ZEND_API ZEND_RESULT_CODE zend_user_it_valid(zend_object_iterator *_iter); ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key); ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter); ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter); @@ -72,13 +72,13 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c ZEND_API void zend_register_interfaces(void); -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); -ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); +ZEND_API ZEND_RESULT_CODE zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); +ZEND_API ZEND_RESULT_CODE zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); -ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); +ZEND_API ZEND_RESULT_CODE zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); +ZEND_API ZEND_RESULT_CODE zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); -ZEND_API int zend_create_internal_iterator_zval(zval *return_value, zval *obj); +ZEND_API ZEND_RESULT_CODE zend_create_internal_iterator_zval(zval *return_value, zval *obj); END_EXTERN_C() From 34766d70b3568fad24bcc1a527df5e58d6b75b9f Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:12:49 +0200 Subject: [PATCH 28/65] Boolify zend_language_scanner.l --- Zend/zend_compile.h | 4 +-- Zend/zend_language_scanner.h | 6 ++--- Zend/zend_language_scanner.l | 48 +++++++++++++++++------------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 2e3444863c6d8..0a4f628600e6f 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -758,7 +758,7 @@ ZEND_API unary_op_type get_unary_op(int opcode); ZEND_API binary_op_type get_binary_op(int opcode); void zend_stop_lexing(void); -void zend_emit_final_return(int return_one); +void zend_emit_final_return(bool return_one); /* Used during AST construction */ zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right); @@ -847,7 +847,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers); uint32_t zend_get_class_fetch_type(zend_string *name); ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc); -ZEND_API ZEND_RESULT_CODE zend_is_smart_branch(const zend_op *opline); +ZEND_API bool zend_is_smart_branch(const zend_op *opline); typedef zend_bool (*zend_auto_global_callback)(zend_string *name); typedef struct _zend_auto_global { diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index c15f11af2e51b..7af718c5a108b 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -75,10 +75,10 @@ typedef struct _zend_nest_location { BEGIN_EXTERN_C() ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state); ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state); -ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename); +ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename); ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding); -ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding); -ZEND_API int zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_filter(const zend_encoding *onetime_encoding); +ZEND_API ZEND_RESULT_CODE zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index d16df9dbec0ec..027eea064e474 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -306,7 +306,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle) } } -ZEND_API int zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) +ZEND_API ZEND_RESULT_CODE zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) { char *ident = (char *) SCNG(yy_start) + ident_ref.offset; size_t length = ident_ref.len; @@ -486,7 +486,7 @@ static const zend_encoding* zend_multibyte_find_script_encoding(void) return CG(script_encoding_list)[0]; } -ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding) +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_filter(const zend_encoding *onetime_encoding) { const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(); const zend_encoding *script_encoding = onetime_encoding ? onetime_encoding: zend_multibyte_find_script_encoding(); @@ -524,10 +524,10 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding) LANG_SCNG(output_filter) = encoding_filter_intermediate_to_internal; } - return 0; + return SUCCESS; } -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle) +ZEND_API ZEND_RESULT_CODE open_file_for_scanning(zend_file_handle *file_handle) { char *buf; size_t size; @@ -680,16 +680,15 @@ ZEND_API zend_ast *zend_compile_string_to_ast( CG(in_compilation) = 1; zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) { - CG(ast) = NULL; - CG(ast_arena) = zend_arena_create(1024 * 32); - LANG_SCNG(yy_state) = yycINITIAL; + zend_prepare_string_for_scanning(&code_zv, filename); + CG(ast) = NULL; + CG(ast_arena) = zend_arena_create(1024 * 32); + LANG_SCNG(yy_state) = yycINITIAL; - if (zendparse() != 0) { - zend_ast_destroy(CG(ast)); - zend_arena_destroy(CG(ast_arena)); - CG(ast) = NULL; - } + if (zendparse() != 0) { + zend_ast_destroy(CG(ast)); + zend_arena_destroy(CG(ast_arena)); + CG(ast) = NULL; } /* restore_lexical_state changes CG(ast) and CG(ast_arena) */ @@ -737,7 +736,7 @@ zend_op_array *compile_filename(int type, zval *filename) return retval; } -ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename) +ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename) { char *buf; size_t size, old_len; @@ -780,7 +779,6 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename) CG(zend_lineno) = 1; CG(increment_lineno) = 0; RESET_DOC_COMMENT(); - return SUCCESS; } @@ -836,7 +834,7 @@ zend_op_array *compile_string(zval *source_string, const char *filename) BEGIN_EXTERN_C() -int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) +ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) { zend_lex_state original_lex_state; zend_file_handle file_handle; @@ -858,7 +856,7 @@ int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_hig return SUCCESS; } -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) +ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) { zend_lex_state original_lex_state; zval tmp; @@ -937,7 +935,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter ZVAL_STRINGL(zendlval, yytext, yyleng); \ } -static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) +static ZEND_RESULT_CODE zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) { register char *s, *t; char *end; @@ -1290,11 +1288,11 @@ static void enter_nesting(char opening) zend_stack_push(&SCNG(nest_location_stack), &nest_loc); } -static int exit_nesting(char closing) +static ZEND_RESULT_CODE exit_nesting(char closing) { if (zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_throw_exception_ex(zend_ce_parse_error, 0, "Unmatched '%c'", closing); - return -1; + return FAILURE; } zend_nest_location *nest_loc = zend_stack_top(&SCNG(nest_location_stack)); @@ -1304,22 +1302,22 @@ static int exit_nesting(char closing) (opening == '[' && closing != ']') || (opening == '(' && closing != ')')) { report_bad_nesting(opening, nest_loc->lineno, closing); - return -1; + return FAILURE; } zend_stack_del_top(&SCNG(nest_location_stack)); - return 0; + return SUCCESS; } -static int check_nesting_at_end() +static ZEND_RESULT_CODE check_nesting_at_end() { if (!zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_nest_location *nest_loc = zend_stack_top(&SCNG(nest_location_stack)); report_bad_nesting(nest_loc->text, nest_loc->lineno, 0); - return -1; + return FAILURE; } - return 0; + return SUCCESS; } #define PARSER_MODE() \ From c389890351f4a2d092eaf285feeb91725424cb5f Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 16:06:29 +0200 Subject: [PATCH 29/65] Voidify language_scanner.l --- Zend/zend_highlight.h | 2 +- Zend/zend_language_scanner.l | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 99bacd19b4377..6f8e5e51be57e 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -40,7 +40,7 @@ BEGIN_EXTERN_C() ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini); ZEND_API void zend_strip(void); ZEND_API ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); -ZEND_API ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); +ZEND_API void highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); ZEND_API void zend_html_putc(char c); ZEND_API void zend_html_puts(const char *s, size_t len); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 027eea064e474..7ebfe30b93ed4 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -821,10 +821,9 @@ zend_op_array *compile_string(zval *source_string, const char *filename) } zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&tmp, filename) == SUCCESS) { - BEGIN(ST_IN_SCRIPTING); - op_array = zend_compile(ZEND_EVAL_CODE); - } + zend_prepare_string_for_scanning(&tmp, filename); + BEGIN(ST_IN_SCRIPTING); + op_array = zend_compile(ZEND_EVAL_CODE); zend_restore_lexical_state(&original_lex_state); zval_ptr_dtor(&tmp); @@ -856,7 +855,7 @@ ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_in return SUCCESS; } -ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) +void highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) { zend_lex_state original_lex_state; zval tmp; @@ -866,13 +865,7 @@ ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax str = &tmp; } zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(str, str_name)==FAILURE) { - zend_restore_lexical_state(&original_lex_state); - if (UNEXPECTED(str == &tmp)) { - zval_ptr_dtor(&tmp); - } - return FAILURE; - } + zend_prepare_string_for_scanning(str, str_name); BEGIN(INITIAL); zend_highlight(syntax_highlighter_ini); if (SCNG(script_filtered)) { @@ -883,7 +876,6 @@ ZEND_RESULT_CODE highlight_string(zval *str, zend_syntax_highlighter_ini *syntax if (UNEXPECTED(str == &tmp)) { zval_ptr_dtor(&tmp); } - return SUCCESS; } ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding) From b915d596c697fa2f81f99abea526ff6d57fe46a1 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:23:28 +0200 Subject: [PATCH 30/65] Voidify zend_list.c --- Zend/zend_list.c | 12 ++++-------- Zend/zend_list.h | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Zend/zend_list.c b/Zend/zend_list.c index fd3db65395f7c..41a51de2e50d9 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -76,14 +76,13 @@ static void zend_resource_dtor(zend_resource *res) } -ZEND_API int ZEND_FASTCALL zend_list_close(zend_resource *res) +ZEND_API void ZEND_FASTCALL zend_list_close(zend_resource *res) { if (GC_REFCOUNT(res) <= 0) { zend_list_free(res); } else if (res->type >= 0) { zend_resource_dtor(res); } - return SUCCESS; } ZEND_API zend_resource* zend_register_resource(void *rsrc_pointer, int rsrc_type) @@ -203,18 +202,16 @@ void plist_entry_destructor(zval *zv) free(res); } -ZEND_API int zend_init_rsrc_list(void) +ZEND_API void zend_init_rsrc_list(void) { zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0); EG(regular_list).nNextFreeElement = 0; - return SUCCESS; } -int zend_init_rsrc_plist(void) +void zend_init_rsrc_plist(void) { zend_hash_init(&EG(persistent_list), 8, NULL, plist_entry_destructor, 1); - return SUCCESS; } @@ -299,11 +296,10 @@ static void list_destructors_dtor(zval *zv) free(Z_PTR_P(zv)); } -int zend_init_rsrc_list_dtors(void) +void zend_init_rsrc_list_dtors(void) { zend_hash_init(&list_destructors, 64, NULL, list_destructors_dtor, 1); list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */ - return SUCCESS; } diff --git a/Zend/zend_list.h b/Zend/zend_list.h index 92fdd3d4178f3..680915121e2a6 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -45,17 +45,17 @@ void list_entry_destructor(zval *ptr); void plist_entry_destructor(zval *ptr); void zend_clean_module_rsrc_dtors(int module_number); -ZEND_API int zend_init_rsrc_list(void); /* Exported for phar hack */ -int zend_init_rsrc_plist(void); +ZEND_API void zend_init_rsrc_list(void); /* Exported for phar hack */ +void zend_init_rsrc_plist(void); void zend_close_rsrc_list(HashTable *ht); void zend_destroy_rsrc_list(HashTable *ht); -int zend_init_rsrc_list_dtors(void); +void zend_init_rsrc_list_dtors(void); void zend_destroy_rsrc_list_dtors(void); ZEND_API zval* ZEND_FASTCALL zend_list_insert(void *ptr, int type); ZEND_API void ZEND_FASTCALL zend_list_free(zend_resource *res); ZEND_API int ZEND_FASTCALL zend_list_delete(zend_resource *res); -ZEND_API int ZEND_FASTCALL zend_list_close(zend_resource *res); +ZEND_API void ZEND_FASTCALL zend_list_close(zend_resource *res); ZEND_API zend_resource *zend_register_resource(void *rsrc_pointer, int rsrc_type); ZEND_API void *zend_fetch_resource(zend_resource *res, const char *resource_type_name, int resource_type); From 18899010e5ce9a1112b77b6b2c80b1d8e3748b7e Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:18:02 +0200 Subject: [PATCH 31/65] Boolify zend_list.c --- Zend/zend_list.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 41a51de2e50d9..ee0e7dcc56b39 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -42,7 +42,7 @@ ZEND_API zval* ZEND_FASTCALL zend_list_insert(void *ptr, int type) return zend_hash_index_add_new(&EG(regular_list), index, &zv); } -ZEND_API int ZEND_FASTCALL zend_list_delete(zend_resource *res) +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_list_delete(zend_resource *res) { if (GC_DELREF(res) <= 0) { return zend_hash_index_del(&EG(regular_list), res->handle); @@ -232,6 +232,7 @@ void zend_destroy_rsrc_list(HashTable *ht) zend_hash_graceful_reverse_destroy(ht); } +/* int return due to HashTable API */ static int clean_module_resource(zval *zv, void *arg) { int resource_id = *(int *)arg; @@ -239,7 +240,7 @@ static int clean_module_resource(zval *zv, void *arg) return Z_RES_TYPE_P(zv) == resource_id; } - +/* int return due to HashTable API */ static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg) { zend_rsrc_list_dtors_entry *ld = (zend_rsrc_list_dtors_entry *)Z_PTR_P(zv); From 3542add16435cb0ba206f884f0fce982b7d371d7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:31:26 +0200 Subject: [PATCH 32/65] Boolify zend_multibyte.c --- Zend/zend_multibyte.c | 14 +++++++------- Zend/zend_multibyte.h | 12 ++++++------ ext/mbstring/mbstring.c | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index 956ffbb74f841..cbf6213b1790c 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -33,7 +33,7 @@ static const char *dummy_encoding_name_getter(const zend_encoding *encoding) return (const char*)encoding; } -static int dummy_encoding_lexer_compatibility_checker(const zend_encoding *encoding) +static bool dummy_encoding_lexer_compatibility_checker(const zend_encoding *encoding) { return 0; } @@ -48,7 +48,7 @@ static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, co return (size_t)-1; } -static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +static ZEND_RESULT_CODE dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { *return_list = pemalloc(0, persistent); *return_size = 0; @@ -60,7 +60,7 @@ static const zend_encoding *dummy_internal_encoding_getter(void) return NULL; } -static int dummy_internal_encoding_setter(const zend_encoding *encoding) +static ZEND_RESULT_CODE dummy_internal_encoding_setter(const zend_encoding *encoding) { return FAILURE; } @@ -84,7 +84,7 @@ ZEND_API const zend_encoding *zend_multibyte_encoding_utf16be = (const zend_enco ZEND_API const zend_encoding *zend_multibyte_encoding_utf16le = (const zend_encoding*)"UTF-32LE"; ZEND_API const zend_encoding *zend_multibyte_encoding_utf8 = (const zend_encoding*)"UTF-8"; -ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions) +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_functions(const zend_multibyte_functions *functions) { zend_multibyte_encoding_utf32be = functions->encoding_fetcher("UTF-32BE"); if (!zend_multibyte_encoding_utf32be) { @@ -155,7 +155,7 @@ ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to return multibyte_functions.encoding_converter(to, to_length, from, from_length, encoding_to, encoding_from); } -ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +ZEND_API ZEND_RESULT_CODE zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return multibyte_functions.encoding_list_parser(encoding_list, encoding_list_len, return_list, return_size, persistent); } @@ -180,12 +180,12 @@ ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_l return SUCCESS; } -ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding) +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_internal_encoding(const zend_encoding *encoding) { return multibyte_functions.internal_encoding_setter(encoding); } -ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) { const zend_encoding **list = 0; size_t size = 0; diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 19444eda83592..2281fb5abfb28 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -26,12 +26,12 @@ typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, typedef const zend_encoding* (*zend_encoding_fetcher)(const char *encoding_name); typedef const char* (*zend_encoding_name_getter)(const zend_encoding *encoding); -typedef int (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding); +typedef bool (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding); typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size); typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from); -typedef int (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent); +typedef ZEND_RESULT_CODE (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(void); -typedef int (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); +typedef ZEND_RESULT_CODE (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); typedef struct _zend_multibyte_functions { const char *provider_name; @@ -57,7 +57,7 @@ ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16le; ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf8; /* multibyte utility functions */ -ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions); +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_functions(const zend_multibyte_functions *functions); ZEND_API void zend_multibyte_restore_functions(void); ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void); @@ -66,13 +66,13 @@ ZEND_API const char *zend_multibyte_get_encoding_name(const zend_encoding *encod ZEND_API int zend_multibyte_check_lexer_compatibility(const zend_encoding *encoding); ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size); ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from); -ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent); +ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void); ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void); ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size); ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding); -ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); +ZEND_API ZEND_RESULT_CODE zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); END_EXTERN_C() diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7bed59422c151..a650f99447f86 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -296,12 +296,12 @@ static size_t count_commas(const char *p, const char *end) { return count; } -/* {{{ static int php_mb_parse_encoding_list() +/* {{{ static ZEND_RESULT_CODE php_mb_parse_encoding_list() * Return FAILURE if input contains any illegal encoding, otherwise SUCCESS. * Emits a ValueError in function context and a warning in INI context, in INI context arg_num must be 0. */ -static int php_mb_parse_encoding_list(const char *value, size_t value_length, - const mbfl_encoding ***return_list, size_t *return_size, int persistent, uint32_t arg_num, +static ZEND_RESULT_CODE php_mb_parse_encoding_list(const char *value, size_t value_length, + const mbfl_encoding ***return_list, size_t *return_size, bool persistent, uint32_t arg_num, zend_bool allow_pass_encoding) { if (value == NULL || value_length == 0) { @@ -450,7 +450,7 @@ static const char *php_mb_zend_encoding_name_getter(const zend_encoding *encodin return ((const mbfl_encoding *)encoding)->name; } -static int php_mb_zend_encoding_lexer_compatibility_checker(const zend_encoding *_encoding) +static bool php_mb_zend_encoding_lexer_compatibility_checker(const zend_encoding *_encoding) { const mbfl_encoding *encoding = (const mbfl_encoding*)_encoding; if (encoding->flag & MBFL_ENCTYPE_SBCS) { @@ -521,7 +521,7 @@ static size_t php_mb_zend_encoding_converter(unsigned char **to, size_t *to_leng return loc; } -static int php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +static ZEND_RESULT_CODE php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return php_mb_parse_encoding_list( encoding_list, encoding_list_len, @@ -534,7 +534,7 @@ static const zend_encoding *php_mb_zend_internal_encoding_getter(void) return (const zend_encoding *)MBSTRG(internal_encoding); } -static int php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) +static ZEND_RESULT_CODE php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) { MBSTRG(internal_encoding) = (const mbfl_encoding *)encoding; return SUCCESS; From ba8a0a3e8b7d2fbc5e42a12fe50fe92026622ec4 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:51:14 +0200 Subject: [PATCH 33/65] Boolify zend_multiply.h --- Zend/zend_arena.h | 4 ++-- Zend/zend_multiply.h | 18 +++++++++--------- ext/opcache/Optimizer/sccp.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Zend/zend_arena.h b/Zend/zend_arena.h index 6ecc1fc85fb46..ff2d0a5fe60df 100644 --- a/Zend/zend_arena.h +++ b/Zend/zend_arena.h @@ -78,7 +78,7 @@ static zend_always_inline void* zend_arena_alloc(zend_arena **arena_ptr, size_t static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t unit_size) { - int overflow; + bool overflow; size_t size; void *ret; @@ -174,7 +174,7 @@ static zend_always_inline void *zend_arena_alloc(zend_arena **arena_ptr, size_t static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t unit_size) { - int overflow; + bool overflow; size_t size; void *ret; diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index a3827d25d128d..c6cd472a237b1 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -154,7 +154,7 @@ #if defined(__GNUC__) && (defined(__native_client__) || defined(i386)) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb; size_t m_overflow = 0; @@ -182,7 +182,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__x86_64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb; zend_ulong m_overflow = 0; @@ -219,7 +219,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__arm__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; zend_ulong m_overflow; @@ -241,7 +241,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__aarch64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; zend_ulong m_overflow; @@ -262,7 +262,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__powerpc64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; unsigned long m_overflow; @@ -286,7 +286,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif SIZEOF_SIZE_T == 4 -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { uint64_t res = (uint64_t) nmemb * (uint64_t) size + (uint64_t) offset; @@ -300,7 +300,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #else -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb * size + offset; double _d = (double)nmemb * (double)size + (double)offset; @@ -317,7 +317,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t size, size_t offset) { - int overflow; + bool overflow; size_t ret = zend_safe_address(nmemb, size, offset, &overflow); if (UNEXPECTED(overflow)) { @@ -330,7 +330,7 @@ static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t /* A bit more generic version of the same */ static zend_always_inline size_t zend_safe_addmult(size_t nmemb, size_t size, size_t offset, const char *message) { - int overflow; + bool overflow; size_t ret = zend_safe_address(nmemb, size, offset, &overflow); if (UNEXPECTED(overflow)) { diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 1615423abe017..d0dffc275da3e 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -788,7 +788,7 @@ static inline int ct_eval_func_call( uint32_t i; zend_execute_data *execute_data, *prev_execute_data; zend_function *func; - int overflow; + bool overflow; if (num_args == 0) { if (zend_string_equals_literal(name, "php_sapi_name") From b935df4d5ec74eaa714105c68897f98f6d889de5 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 01:59:40 +0200 Subject: [PATCH 34/65] Boolify zend_object_handler.c --- Zend/zend_object_handlers.c | 26 +++++++++++++------------- Zend/zend_object_handlers.h | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index b3eb2d1ba597b..5c9c6b8db7031 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -138,7 +138,7 @@ ZEND_API HashTable *zend_std_get_gc(zend_object *zobj, zval **table, int *n) /* } /* }}} */ -ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ +ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */ { zend_class_entry *ce = object->ce; zval retval; @@ -223,7 +223,7 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla } /* }}} */ -static zend_never_inline int is_protected_compatible_scope(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ +static zend_never_inline bool is_protected_compatible_scope(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { return scope && (is_derived_class(ce, scope) || is_derived_class(scope, ce)); @@ -267,7 +267,7 @@ static ZEND_COLD zend_never_inline void zend_forbidden_dynamic_property( ZSTR_VAL(ce->name), ZSTR_VAL(member)); } -static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *ce, zend_string *member, int silent, void **cache_slot, zend_property_info **info_ptr) /* {{{ */ +static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *ce, zend_string *member, bool silent, void **cache_slot, zend_property_info **info_ptr) /* {{{ */ { zval *zv; zend_property_info *property_info; @@ -443,7 +443,7 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s } /* }}} */ -ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic) /* {{{ */ { zend_property_info *property_info; const char *class_name = NULL; @@ -875,11 +875,11 @@ ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval * } /* }}} */ -ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */ +ZEND_API bool zend_std_has_dimension(zend_object *object, zval *offset, bool check_empty) /* {{{ */ { zend_class_entry *ce = object->ce; zval retval, tmp_offset; - int result; + bool result; if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) { ZVAL_COPY_DEREF(&tmp_offset, offset); @@ -1074,7 +1074,7 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas /* Ensures that we're allowed to call a protected method. */ -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ +ZEND_API bool zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { zend_class_entry *fbc_scope = ce; @@ -1101,7 +1101,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } /* }}} */ -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static) /* {{{ */ +ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, bool is_static) /* {{{ */ { size_t mname_len; zend_op_array *func; @@ -1599,9 +1599,9 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */ } /* }}} */ -ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */ +ZEND_API bool zend_std_has_property(zend_object *zobj, zend_string *name, bool has_set_exists, void **cache_slot) /* {{{ */ { - int result; + bool result; zval *value = NULL; uintptr_t property_offset; zend_property_info *prop_info = NULL; @@ -1707,7 +1707,7 @@ ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj) /* {{{ */ } /* }}} */ -ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */ { switch (type) { case IS_STRING: { @@ -1737,7 +1737,7 @@ ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, } /* }}} */ -ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */ { zval *func; zend_class_entry *ce = obj->ce; @@ -1766,7 +1766,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purp switch (purpose) { case ZEND_PROP_PURPOSE_DEBUG: if (obj->handlers->get_debug_info) { - int is_temp; + bool is_temp; ht = obj->handlers->get_debug_info(obj, &is_temp); if (ht && !is_temp && !(GC_FLAGS(ht) & GC_IMMUTABLE)) { GC_ADDREF(ht); diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index fedc70cc80997..a6ce3a84d0010 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -75,10 +75,10 @@ typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_st * 1 (set) whether property exists and is true * 2 (exists) whether property exists */ -typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot); +typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, bool has_set_exists, void **cache_slot); /* Used to check if a dimension of the object exists */ -typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, int check_empty); +typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, bool check_empty); /* Used to remove a property of the object */ typedef void (*zend_object_unset_property_t)(zend_object *object, zend_string *member, void **cache_slot); @@ -89,7 +89,7 @@ typedef void (*zend_object_unset_dimension_t)(zend_object *object, zval *offset) /* Used to get hash of the properties of the object, as hash of zval's */ typedef HashTable *(*zend_object_get_properties_t)(zend_object *object); -typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp); +typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, bool *is_temp); typedef enum _zend_prop_purpose { /* Used for debugging. Supersedes get_debug_info handler. */ @@ -193,31 +193,31 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, int type); ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); ZEND_API zend_function *zend_std_get_constructor(zend_object *object); -ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent); +ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, bool silent); ZEND_API HashTable *zend_std_get_properties(zend_object *object); ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n); -ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp); -ZEND_API int zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type); +ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp); +ZEND_API ZEND_RESULT_CODE zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type); ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot); ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); ZEND_API zval *zend_std_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); -ZEND_API int zend_std_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot); +ZEND_API bool zend_std_has_property(zend_object *object, zend_string *member, bool has_set_exists, void **cache_slot); ZEND_API void zend_std_unset_property(zend_object *object, zend_string *member, void **cache_slot); ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv); ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value); -ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty); +ZEND_API bool zend_std_has_dimension(zend_object *object, zval *offset, bool check_empty); ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset); ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key); ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj); ZEND_API int zend_std_compare_objects(zval *o1, zval *o2); -ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only); +ZEND_API ZEND_RESULT_CODE zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only); ZEND_API void rebuild_object_properties(zend_object *zobj); -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); +ZEND_API bool zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic); +ZEND_API ZEND_RESULT_CODE zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic); -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static); +ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, bool is_static); ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member); From b73b448781e5a1fd4b743985fc18bc2567c453be Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 03:49:34 +0200 Subject: [PATCH 35/65] Revert "Boolify zend_object_handler.c" Due to incompatible pointers This reverts commit 17eaad3caa225f44d88e246d0ec27694cdef40ad. --- Zend/zend_object_handlers.c | 26 +++++++++++++------------- Zend/zend_object_handlers.h | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 5c9c6b8db7031..b3eb2d1ba597b 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -138,7 +138,7 @@ ZEND_API HashTable *zend_std_get_gc(zend_object *zobj, zval **table, int *n) /* } /* }}} */ -ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */ +ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { zend_class_entry *ce = object->ce; zval retval; @@ -223,7 +223,7 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla } /* }}} */ -static zend_never_inline bool is_protected_compatible_scope(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ +static zend_never_inline int is_protected_compatible_scope(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { return scope && (is_derived_class(ce, scope) || is_derived_class(scope, ce)); @@ -267,7 +267,7 @@ static ZEND_COLD zend_never_inline void zend_forbidden_dynamic_property( ZSTR_VAL(ce->name), ZSTR_VAL(member)); } -static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *ce, zend_string *member, bool silent, void **cache_slot, zend_property_info **info_ptr) /* {{{ */ +static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *ce, zend_string *member, int silent, void **cache_slot, zend_property_info **info_ptr) /* {{{ */ { zval *zv; zend_property_info *property_info; @@ -443,7 +443,7 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic) /* {{{ */ +ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic) /* {{{ */ { zend_property_info *property_info; const char *class_name = NULL; @@ -875,11 +875,11 @@ ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval * } /* }}} */ -ZEND_API bool zend_std_has_dimension(zend_object *object, zval *offset, bool check_empty) /* {{{ */ +ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */ { zend_class_entry *ce = object->ce; zval retval, tmp_offset; - bool result; + int result; if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) { ZVAL_COPY_DEREF(&tmp_offset, offset); @@ -1074,7 +1074,7 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas /* Ensures that we're allowed to call a protected method. */ -ZEND_API bool zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ +ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { zend_class_entry *fbc_scope = ce; @@ -1101,7 +1101,7 @@ ZEND_API bool zend_check_protected(zend_class_entry *ce, zend_class_entry *scope } /* }}} */ -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, bool is_static) /* {{{ */ +ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static) /* {{{ */ { size_t mname_len; zend_op_array *func; @@ -1599,9 +1599,9 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */ } /* }}} */ -ZEND_API bool zend_std_has_property(zend_object *zobj, zend_string *name, bool has_set_exists, void **cache_slot) /* {{{ */ +ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */ { - bool result; + int result; zval *value = NULL; uintptr_t property_offset; zend_property_info *prop_info = NULL; @@ -1707,7 +1707,7 @@ ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */ +ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */ { switch (type) { case IS_STRING: { @@ -1737,7 +1737,7 @@ ZEND_API ZEND_RESULT_CODE zend_std_cast_object_tostring(zend_object *readobj, zv } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */ +ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */ { zval *func; zend_class_entry *ce = obj->ce; @@ -1766,7 +1766,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purp switch (purpose) { case ZEND_PROP_PURPOSE_DEBUG: if (obj->handlers->get_debug_info) { - bool is_temp; + int is_temp; ht = obj->handlers->get_debug_info(obj, &is_temp); if (ht && !is_temp && !(GC_FLAGS(ht) & GC_IMMUTABLE)) { GC_ADDREF(ht); diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index a6ce3a84d0010..fedc70cc80997 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -75,10 +75,10 @@ typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_st * 1 (set) whether property exists and is true * 2 (exists) whether property exists */ -typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, bool has_set_exists, void **cache_slot); +typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot); /* Used to check if a dimension of the object exists */ -typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, bool check_empty); +typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, int check_empty); /* Used to remove a property of the object */ typedef void (*zend_object_unset_property_t)(zend_object *object, zend_string *member, void **cache_slot); @@ -89,7 +89,7 @@ typedef void (*zend_object_unset_dimension_t)(zend_object *object, zval *offset) /* Used to get hash of the properties of the object, as hash of zval's */ typedef HashTable *(*zend_object_get_properties_t)(zend_object *object); -typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, bool *is_temp); +typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp); typedef enum _zend_prop_purpose { /* Used for debugging. Supersedes get_debug_info handler. */ @@ -193,31 +193,31 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, int type); ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); ZEND_API zend_function *zend_std_get_constructor(zend_object *object); -ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, bool silent); +ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent); ZEND_API HashTable *zend_std_get_properties(zend_object *object); ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n); -ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp); -ZEND_API ZEND_RESULT_CODE zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type); +ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp); +ZEND_API int zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type); ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot); ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); ZEND_API zval *zend_std_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); -ZEND_API bool zend_std_has_property(zend_object *object, zend_string *member, bool has_set_exists, void **cache_slot); +ZEND_API int zend_std_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot); ZEND_API void zend_std_unset_property(zend_object *object, zend_string *member, void **cache_slot); ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv); ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value); -ZEND_API bool zend_std_has_dimension(zend_object *object, zval *offset, bool check_empty); +ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty); ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset); ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key); ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj); ZEND_API int zend_std_compare_objects(zval *o1, zval *o2); -ZEND_API ZEND_RESULT_CODE zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only); +ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only); ZEND_API void rebuild_object_properties(zend_object *zobj); -ZEND_API bool zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); +ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API ZEND_RESULT_CODE zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic); +ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic); -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, bool is_static); +ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static); ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member); From 13b326ee619a8a4f857fe16f39414fca82d064fa Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 02:01:58 +0200 Subject: [PATCH 36/65] Voidify zend_opcode.c --- Zend/zend_compile.h | 2 +- Zend/zend_opcode.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 0a4f628600e6f..1010a250276f3 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -841,7 +841,7 @@ typedef zend_bool (*zend_needs_live_range_cb)(zend_op_array *op_array, zend_op * ZEND_API void zend_recalc_live_ranges( zend_op_array *op_array, zend_needs_live_range_cb needs_live_range); -ZEND_API int pass_two(zend_op_array *op_array); +ZEND_API void pass_two(zend_op_array *op_array); ZEND_API zend_bool zend_is_compiling(void); ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 14dd6e46db27d..a9236faf6a68c 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -907,12 +907,12 @@ ZEND_API void zend_recalc_live_ranges( zend_calc_live_ranges(op_array, needs_live_range); } -ZEND_API int pass_two(zend_op_array *op_array) +ZEND_API void pass_two(zend_op_array *op_array) { zend_op *opline, *end; if (!ZEND_USER_CODE(op_array->type)) { - return 0; + return; } if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) { zend_update_extended_stmts(op_array); @@ -1074,7 +1074,7 @@ ZEND_API int pass_two(zend_op_array *op_array) zend_calc_live_ranges(op_array, NULL); - return 0; + return; } ZEND_API unary_op_type get_unary_op(int opcode) From 9d31dc9e3148c94ba7bd3b2cd0dc47fc1c8b0131 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 02:25:23 +0200 Subject: [PATCH 37/65] Boolify zend_operators.c --- Zend/zend_operators.c | 83 ++++++++++++++++++++++--------------------- Zend/zend_operators.h | 70 ++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 76 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index fba6c6337a7eb..9e91069e78b7c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -232,7 +232,7 @@ static zend_never_inline zval* ZEND_FASTCALL _zendi_convert_scalar_to_number_sil } /* }}} */ -static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { switch (Z_TYPE_P(op)) { case IS_NULL: @@ -274,7 +274,7 @@ static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(z } /* }}} */ -static zend_always_inline int zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { if (Z_TYPE_P(op) == IS_LONG || Z_TYPE_P(op) == IS_DOUBLE) { ZVAL_COPY_VALUE(holder, op); @@ -559,7 +559,7 @@ ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */ ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ { - int tmp; + bool tmp; try_again: switch (Z_TYPE_P(op)) { @@ -963,7 +963,7 @@ static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zva } /* }}} */ -static zend_always_inline int add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -987,7 +987,7 @@ static zend_always_inline int add_function_fast(zval *result, zval *op1, zval *o } } /* }}} */ -static zend_never_inline int ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1019,7 +1019,7 @@ static zend_never_inline int ZEND_FASTCALL add_function_slow(zval *result, zval return FAILURE; } /* }}} */ -ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (add_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1029,7 +1029,7 @@ ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static zend_always_inline int sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1051,7 +1051,7 @@ static zend_always_inline int sub_function_fast(zval *result, zval *op1, zval *o } /* }}} */ -static zend_never_inline int ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1084,7 +1084,7 @@ static zend_never_inline int ZEND_FASTCALL sub_function_slow(zval *result, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (sub_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1094,7 +1094,7 @@ ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static zend_always_inline int mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline ZEND_RESULT_CODE mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1120,7 +1120,7 @@ static zend_always_inline int mul_function_fast(zval *result, zval *op1, zval *o } /* }}} */ -static zend_never_inline int ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1153,7 +1153,7 @@ static zend_never_inline int ZEND_FASTCALL mul_function_slow(zval *result, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (mul_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1163,7 +1163,7 @@ ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static int ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static ZEND_RESULT_CODE ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1220,7 +1220,7 @@ static int ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) / } /* }}} */ -ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1256,7 +1256,7 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* { #ifdef __clang__ __attribute__((no_sanitize("float-divide-by-zero"))) #endif -static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static ZEND_RESULT_CODE ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1300,7 +1300,7 @@ static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) / } /* }}} */ -ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1333,7 +1333,7 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1367,7 +1367,7 @@ ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { int op1_val, op2_val; @@ -1417,7 +1417,7 @@ ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ { if (Z_TYPE_P(op1) < IS_TRUE) { ZVAL_TRUE(result); @@ -1442,7 +1442,7 @@ ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -1482,7 +1482,7 @@ ZEND_API int ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1564,7 +1564,7 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1646,7 +1646,7 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1728,7 +1728,7 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1765,7 +1765,7 @@ ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op } /* }}} */ -ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1801,7 +1801,7 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zval *orig_op1 = op1; zval op1_copy, op2_copy; @@ -1992,7 +1992,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_LONG(result, zend_compare(op1, op2)); return SUCCESS; @@ -2175,6 +2175,7 @@ ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */ } /* }}} */ +/* return int to be compatible with compare_func_t */ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */ { /* is_identical_function() returns 1 in case of identity and 0 in case @@ -2217,42 +2218,42 @@ ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, !zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_compare(op1, op2) == 0); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) != 0)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) < 0)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0)); return SUCCESS; @@ -2395,7 +2396,7 @@ static void ZEND_FASTCALL increment_string(zval *str) /* {{{ */ } /* }}} */ -ZEND_API int ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -2460,7 +2461,7 @@ ZEND_API int ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API int ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ { zend_long lval; double dval; @@ -2523,13 +2524,13 @@ ZEND_API int ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ { return i_zend_is_true(op); } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ { zend_object *zobj = Z_OBJ_P(op); zval tmp; @@ -2621,7 +2622,7 @@ ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup_ex(const char *source, size_t } /* }}} */ -ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, int persistent) /* {{{ */ +ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent) /* {{{ */ { size_t length = ZSTR_LEN(str); unsigned char *p = (unsigned char *) ZSTR_VAL(str); @@ -2817,9 +2818,9 @@ ZEND_API int ZEND_FASTCALL zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /* {{{ */ { - int ret1, ret2; + zend_uchar ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; @@ -2867,7 +2868,7 @@ ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) / ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */ { - int ret1, ret2; + zend_uchar ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 9eb064b125d7a..76d0749703ee0 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -38,30 +38,30 @@ #define LONG_SIGN_MASK ZEND_LONG_MIN BEGIN_EXTERN_C() -ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); -ZEND_API int ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); -ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce); ZEND_API zend_bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *instance_ce, const zend_class_entry *ce); @@ -255,8 +255,8 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const } } -ZEND_API int ZEND_FASTCALL increment_function(zval *op1); -ZEND_API int ZEND_FASTCALL decrement_function(zval *op2); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL increment_function(zval *op1); +ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL decrement_function(zval *op2); ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op); ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op); @@ -341,15 +341,15 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); } -ZEND_API int ZEND_FASTCALL zend_is_true(zval *op); -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op); +ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op); +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op); #define zval_is_true(op) \ zend_is_true(op) -static zend_always_inline int i_zend_is_true(zval *op) +static zend_always_inline bool i_zend_is_true(zval *op) { - int result = 0; + bool result = 0; again: switch (Z_TYPE_P(op)) { @@ -418,7 +418,7 @@ ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup(const char *source, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup_ex(const char *source, size_t length); -ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, int persistent); +ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent); #define zend_string_tolower(str) zend_string_tolower_ex(str, 0) @@ -433,7 +433,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp(const char *s1, size_t len1, ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2); ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); -ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2); +ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2); ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2); ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2); ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2); @@ -738,7 +738,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2) +static zend_always_inline ZEND_RESULT_CODE fast_add_function(zval *result, zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { @@ -842,12 +842,12 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2) +static zend_always_inline ZEND_RESULT_CODE fast_div_function(zval *result, zval *op1, zval *op2) { return div_function(result, op1, op2); } -static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_string *s2) +static zend_always_inline bool zend_fast_equal_strings(zend_string *s1, zend_string *s2) { if (s1 == s2) { return 1; @@ -858,7 +858,7 @@ static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_stri } } -static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_function(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { @@ -880,7 +880,7 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) return zend_compare(op1, op2) == 0; } -static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_long(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { return Z_LVAL_P(op1) == Z_LVAL_P(op2); @@ -888,7 +888,7 @@ static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) return zend_compare(op1, op2) == 0; } -static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_string(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); From 3a6fc73880aec11301f725d6dcf23de9a1133bea Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:13:14 +0200 Subject: [PATCH 38/65] Boolify zend_signal.c --- Zend/zend_signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index 2086f03dd881c..75cc994f69dd2 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -283,7 +283,7 @@ ZEND_API int zend_signal(int signo, void (*handler)(int)) * Set a handler for a signal we want to defer. * Previously set handler must have been saved before. */ -static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) +static ZEND_RESULT_CODE zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) { struct sigaction sa; From 9fdb0dcc822a5412cd8e13c888cfdeaea40c20e3 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:14:06 +0200 Subject: [PATCH 39/65] Voidify zend_signal.c --- Zend/zend_signal.c | 8 +++----- Zend/zend_signal.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index 75cc994f69dd2..79043b199ea60 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -223,7 +223,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context) /* {{{ zend_sigaction * Register a signal handler that will be deferred in critical sections */ -ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact) +ZEND_API void zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact) { struct sigaction sa; sigset_t sigset; @@ -259,14 +259,12 @@ ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigac sigaddset(&sigset, signo); zend_sigprocmask(SIG_UNBLOCK, &sigset, NULL); } - - return SUCCESS; } /* }}} */ /* {{{ zend_signal * Register a signal handler that will be deferred in critical sections */ -ZEND_API int zend_signal(int signo, void (*handler)(int)) +ZEND_API void zend_signal(int signo, void (*handler)(int)) { struct sigaction sa; @@ -275,7 +273,7 @@ ZEND_API int zend_signal(int signo, void (*handler)(int)) sa.sa_handler = handler; sa.sa_mask = global_sigmask; - return zend_sigaction(signo, &sa, NULL); + zend_sigaction(signo, &sa, NULL); } /* }}} */ diff --git a/Zend/zend_signal.h b/Zend/zend_signal.h index 0bb191db73245..08c9de20c76c3 100644 --- a/Zend/zend_signal.h +++ b/Zend/zend_signal.h @@ -91,8 +91,8 @@ ZEND_API void zend_signal_startup(void); END_EXTERN_C() void zend_signal_init(void); -ZEND_API int zend_signal(int signo, void (*handler)(int)); -ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact); +ZEND_API void zend_signal(int signo, void (*handler)(int)); +ZEND_API void zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact); #else /* ZEND_SIGNALS */ From d476a97a077eec47d2cde7e50f43ecb1b0d413a9 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:27:05 +0200 Subject: [PATCH 40/65] Fix PCNTL Code due to zend_sigaction() voidification --- ext/pcntl/php_signal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 95b4a16d6df9e..d618800480827 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -48,9 +48,7 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ #endif } - if (zend_sigaction(signo, &act, &oact) < 0) { - return (void*)SIG_ERR; - } + zend_sigaction(signo, &act, &oact); #ifdef HAVE_STRUCT_SIGINFO_T return oact.sa_sigaction; From 22e5f71382011856dbea948ec51cb904685d6f88 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:22:30 +0200 Subject: [PATCH 41/65] Voidify zend_stack.c --- Zend/zend_stack.c | 12 ++++-------- Zend/zend_stack.h | 8 ++++---- ext/mysqlnd/mysqlnd_debug.c | 3 ++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 51f68b5c9a2c9..1255c941a03d6 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -22,13 +22,12 @@ #define ZEND_STACK_ELEMENT(stack, n) ((void *)((char *) (stack)->elements + (stack)->size * (n))) -ZEND_API int zend_stack_init(zend_stack *stack, int size) +ZEND_API void zend_stack_init(zend_stack *stack, int size) { stack->size = size; stack->top = 0; stack->max = 0; stack->elements = NULL; - return SUCCESS; } ZEND_API int zend_stack_push(zend_stack *stack, const void *element) @@ -53,10 +52,9 @@ ZEND_API void *zend_stack_top(const zend_stack *stack) } -ZEND_API int zend_stack_del_top(zend_stack *stack) +ZEND_API void zend_stack_del_top(zend_stack *stack) { --stack->top; - return SUCCESS; } @@ -71,20 +69,18 @@ ZEND_API int zend_stack_int_top(const zend_stack *stack) } -ZEND_API int zend_stack_is_empty(const zend_stack *stack) +ZEND_API bool zend_stack_is_empty(const zend_stack *stack) { return stack->top == 0; } -ZEND_API int zend_stack_destroy(zend_stack *stack) +ZEND_API void zend_stack_destroy(zend_stack *stack) { if (stack->elements) { efree(stack->elements); stack->elements = NULL; } - - return SUCCESS; } diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index 912850a25e4c6..a5aa9622268b2 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -29,13 +29,13 @@ typedef struct _zend_stack { #define STACK_BLOCK_SIZE 16 BEGIN_EXTERN_C() -ZEND_API int zend_stack_init(zend_stack *stack, int size); +ZEND_API void zend_stack_init(zend_stack *stack, int size); ZEND_API int zend_stack_push(zend_stack *stack, const void *element); ZEND_API void *zend_stack_top(const zend_stack *stack); -ZEND_API int zend_stack_del_top(zend_stack *stack); +ZEND_API void zend_stack_del_top(zend_stack *stack); ZEND_API int zend_stack_int_top(const zend_stack *stack); -ZEND_API int zend_stack_is_empty(const zend_stack *stack); -ZEND_API int zend_stack_destroy(zend_stack *stack); +ZEND_API bool zend_stack_is_empty(const zend_stack *stack); +ZEND_API void zend_stack_destroy(zend_stack *stack); ZEND_API void *zend_stack_base(const zend_stack *stack); ZEND_API int zend_stack_count(const zend_stack *stack); ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)); diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index ec698a265dcf7..ab02d5645a7f9 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -412,7 +412,8 @@ MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int lin #endif } - return zend_stack_del_top(&self->call_stack) == SUCCESS? PASS:FAIL; + zend_stack_del_top(&self->call_stack); + return PASS; } /* }}} */ From efdf2d1db9f8bc4812794d5931e920afc764fece Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:24:52 +0200 Subject: [PATCH 42/65] Boolify zend_stream.c --- Zend/zend_stream.c | 6 +++--- Zend/zend_stream.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 38b145736bea2..87d90a7b9869c 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -73,7 +73,7 @@ ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *fi handle->filename = filename; } -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ { zend_string *opened_path; if (zend_stream_open_function) { @@ -113,7 +113,7 @@ static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len); } /* }}} */ -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ +ZEND_API ZEND_RESULT_CODE zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ { size_t file_size; @@ -232,7 +232,7 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */ } /* }}} */ -ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ +ZEND_API bool zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ { if (fh1->type != fh2->type) { return 0; diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 51651add38278..3f7df9d4e2ba9 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -66,10 +66,10 @@ typedef struct _zend_file_handle { BEGIN_EXTERN_C() ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename); ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename); -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle); -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); +ZEND_API ZEND_RESULT_CODE zend_stream_open(const char *filename, zend_file_handle *handle); +ZEND_API ZEND_RESULT_CODE zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); -ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); +ZEND_API bool zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); END_EXTERN_C() #ifdef ZEND_WIN32 From 14e6f25cedb87a67ee69be29bd24615ecfbd3d91 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:28:37 +0200 Subject: [PATCH 43/65] Boolify zend_string.c --- Zend/zend_string.c | 10 +++++----- Zend/zend_string.h | 20 ++++++++++---------- ext/opcache/ZendAccelerator.c | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 7eae674f08a21..570aeece61e22 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -28,8 +28,8 @@ ZEND_API zend_string_init_interned_func_t zend_string_init_interned; static zend_string* ZEND_FASTCALL zend_new_interned_string_permanent(zend_string *str); static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string *str); -static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, int permanent); -static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, int permanent); +static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, bool permanent); +static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, bool permanent); /* Any strings interned in the startup phase. Common to all the threads, won't be free'd until process exit. If we want an ability to @@ -67,7 +67,7 @@ ZEND_KNOWN_STRINGS(_ZEND_STR_DSC) NULL }; -static zend_always_inline void zend_init_interned_strings_ht(HashTable *interned_strings, int permanent) +static zend_always_inline void zend_init_interned_strings_ht(HashTable *interned_strings, bool permanent) { zend_hash_init(interned_strings, 1024, NULL, _str_dtor, permanent); if (permanent) { @@ -251,7 +251,7 @@ static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string * return ret; } -static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, bool permanent) { zend_string *ret; zend_ulong h = zend_inline_hash_func(str, size); @@ -267,7 +267,7 @@ static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char return zend_add_interned_string(ret, &interned_strings_permanent, IS_STR_PERMANENT); } -static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, bool permanent) { zend_string *ret; zend_ulong h = zend_inline_hash_func(str, size); diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 98bd735976487..316d022e647a7 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -25,7 +25,7 @@ BEGIN_EXTERN_C() typedef void (*zend_string_copy_storage_func_t)(void); typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str); -typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, int permanent); +typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, bool permanent); ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string; ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned; @@ -136,7 +136,7 @@ static zend_always_inline uint32_t zend_string_delref(zend_string *s) return 1; } -static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent) +static zend_always_inline zend_string *zend_string_alloc(size_t len, bool persistent) { zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); @@ -147,7 +147,7 @@ static zend_always_inline zend_string *zend_string_alloc(size_t len, int persist return ret; } -static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, bool persistent) { zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); @@ -158,7 +158,7 @@ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m return ret; } -static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, bool persistent) { zend_string *ret = zend_string_alloc(len, persistent); @@ -186,7 +186,7 @@ static zend_always_inline zend_string *zend_string_copy(zend_string *s) return s; } -static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) +static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool persistent) { if (ZSTR_IS_INTERNED(s)) { return s; @@ -195,7 +195,7 @@ static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persi } } -static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -214,7 +214,7 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_ return ret; } -static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -234,7 +234,7 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t return ret; } -static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -254,7 +254,7 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size return ret; } -static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, bool persistent) { zend_string *ret; @@ -298,7 +298,7 @@ static zend_always_inline void zend_string_release(zend_string *s) } } -static zend_always_inline void zend_string_release_ex(zend_string *s, int persistent) +static zend_always_inline void zend_string_release_ex(zend_string *s, bool persistent) { if (!ZSTR_IS_INTERNED(s)) { if (GC_DELREF(s) == 0) { diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index bde6e0eb7138a..f532596f0f9a7 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -551,7 +551,7 @@ static zend_always_inline zend_string *accel_find_interned_string_ex(zend_ulong return NULL; } -static zend_string* ZEND_FASTCALL accel_init_interned_string_for_php(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL accel_init_interned_string_for_php(const char *str, size_t size, bool permanent) { if (ZCG(counted)) { zend_ulong h = zend_inline_hash_func(str, size); From d81edcb1f8f428041f21e3a5fbd66a619a64bb56 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 03:56:32 +0200 Subject: [PATCH 44/65] Update FTP code after zend_list_close() voidification --- ext/ftp/php_ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 2da4769aa5172..b27fbef0128c3 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -1235,7 +1235,7 @@ PHP_FUNCTION(ftp_close) ftp_quit(ftp); - RETURN_BOOL(zend_list_close(Z_RES_P(z_ftp)) == SUCCESS); + RETURN_TRUE; } /* }}} */ From 73e6f4d0fe45332ae54e4560bd3e45867548afaa Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:18:39 +0200 Subject: [PATCH 45/65] Fix streamfuncs.c due to zend_list_close() voidification --- ext/standard/streamsfuncs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 1c49b26ac7db1..eb450efe5444c 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1245,13 +1245,9 @@ PHP_FUNCTION(stream_filter_remove) RETURN_FALSE; } - if (zend_list_close(Z_RES_P(zfilter)) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Could not invalidate filter, not removing"); - RETURN_FALSE; - } else { - php_stream_filter_remove(filter, 1); - RETURN_TRUE; - } + zend_list_close(Z_RES_P(zfilter)); + php_stream_filter_remove(filter, 1); + RETURN_TRUE; } /* }}} */ From 6d9a6c781e349b1f139f0ae7a0d0bc89013870ea Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 04:54:01 +0200 Subject: [PATCH 46/65] Fix ZIP after zend_list_close() voidification --- ext/zip/php_zip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 43c2da9af6660..c1a569afec4a7 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1290,7 +1290,8 @@ PHP_FUNCTION(zip_entry_close) RETURN_THROWS(); } - RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(zip_entry))); + zend_list_close(Z_RES_P(zip_entry)); + RETURN_TRUE; } /* }}} */ From f93e1056b2ba2fc0fdb435889fb8617f6e3fa9a0 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 16:14:01 +0200 Subject: [PATCH 47/65] Fix Tokenizer extension after voidification of zend_prepare_string_for_scanning() --- ext/tokenizer/tokenizer.c | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 2656ce8f73940..d12b5edba8ded 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -358,10 +358,7 @@ static zend_bool tokenize(zval *return_value, zend_string *source, zend_class_en ZVAL_STR_COPY(&source_zval, source); zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&source_zval, "") == FAILURE) { - zend_restore_lexical_state(&original_lex_state); - return 0; - } + zend_prepare_string_for_scanning(&source_zval, ""); LANG_SCNG(yy_state) = yycINITIAL; zend_hash_init(&interned_strings, 0, NULL, NULL, 0); @@ -484,6 +481,8 @@ static zend_bool tokenize_parse( zval *return_value, zend_string *source, zend_class_entry *token_class) { zval source_zval; + struct event_context ctx; + zval token_stream; zend_lex_state original_lex_state; zend_bool original_in_compilation; zend_bool success; @@ -494,30 +493,27 @@ static zend_bool tokenize_parse( CG(in_compilation) = 1; zend_save_lexical_state(&original_lex_state); - if ((success = (zend_prepare_string_for_scanning(&source_zval, "") == SUCCESS))) { - struct event_context ctx; - zval token_stream; - array_init(&token_stream); - - ctx.tokens = &token_stream; - ctx.token_class = token_class; + zend_prepare_string_for_scanning(&source_zval, ""); + array_init(&token_stream); - CG(ast) = NULL; - CG(ast_arena) = zend_arena_create(1024 * 32); - LANG_SCNG(yy_state) = yycINITIAL; - LANG_SCNG(on_event) = on_event; - LANG_SCNG(on_event_context) = &ctx; + ctx.tokens = &token_stream; + ctx.token_class = token_class; - if((success = (zendparse() == SUCCESS))) { - ZVAL_COPY_VALUE(return_value, &token_stream); - } else { - zval_ptr_dtor(&token_stream); - } + CG(ast) = NULL; + CG(ast_arena) = zend_arena_create(1024 * 32); + LANG_SCNG(yy_state) = yycINITIAL; + LANG_SCNG(on_event) = on_event; + LANG_SCNG(on_event_context) = &ctx; - zend_ast_destroy(CG(ast)); - zend_arena_destroy(CG(ast_arena)); + if((success = (zendparse() == SUCCESS))) { + ZVAL_COPY_VALUE(return_value, &token_stream); + } else { + zval_ptr_dtor(&token_stream); } + zend_ast_destroy(CG(ast)); + zend_arena_destroy(CG(ast_arena)); + /* restore compiler and scanner global states */ zend_restore_lexical_state(&original_lex_state); CG(in_compilation) = original_in_compilation; From f4e9196569ee93c23fd48b8c61d573563fa8a024 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 17:24:05 +0200 Subject: [PATCH 48/65] Fix PHP_FUNCTION(highlight_string) after voidification of highlight_string --- ext/standard/basic_functions.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 51a44a3ffb15b..30080bcc36c56 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1989,14 +1989,7 @@ PHP_FUNCTION(highlight_string) hicompiled_string_description = zend_make_compiled_string_description("highlighted code"); - if (highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description) == FAILURE) { - efree(hicompiled_string_description); - EG(error_reporting) = old_error_reporting; - if (i) { - php_output_end(); - } - RETURN_FALSE; - } + highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description); efree(hicompiled_string_description); EG(error_reporting) = old_error_reporting; @@ -2006,6 +1999,7 @@ PHP_FUNCTION(highlight_string) php_output_discard(); ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING); } else { + // TODO Make this function void? RETURN_TRUE; } } From 36b9243833413af4e3d0cf7fd99093c4aeab69b8 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 19:48:36 +0200 Subject: [PATCH 49/65] Boolify zend_virtual_cwd.c --- Zend/zend_virtual_cwd.c | 14 +++++++++----- Zend/zend_virtual_cwd.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 61542bfce200e..dab7fdca3b0d0 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -483,7 +483,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void) #undef LINK_MAX #define LINK_MAX 32 -static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir) /* {{{ */ +static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, bool is_dir, int *link_is_dir) /* {{{ */ { size_t i, j; int directory = 0, save; @@ -996,7 +996,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim /* }}} */ /* Resolve path relatively to state and put the real path into state */ -/* returns 0 for ok, 1 for error */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) /* {{{ */ { size_t path_length = strlen(path); @@ -1005,7 +1005,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func int ll = 0; time_t t; int ret; - int add_slash; + bool add_slash; void *tmp; if (!path_length || path_length >= MAXPATHLEN-1) { @@ -1178,12 +1178,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func } /* }}} */ -CWD_API int virtual_chdir(const char *path) /* {{{ */ +CWD_API ZEND_RESULT_CODE virtual_chdir(const char *path) /* {{{ */ { - return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; + return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH) ? FAILURE : SUCCESS; } /* }}} */ + +/* returns 0 for ok, 1 for empty string, -1 on error */ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path)) /* {{{ */ { size_t length = strlen(path); @@ -1255,6 +1257,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */ } /* }}} */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path) /* {{{ */ { cwd_state new_state; @@ -1270,6 +1273,7 @@ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_f } /* }}} */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_filepath(const char *path, char **filepath) /* {{{ */ { return virtual_filepath_ex(path, filepath, php_is_file_ok); diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 84a1562c7789f..dfaa95932c3b6 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -189,6 +189,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li /* One of the following constants must be used as the last argument in virtual_file_ex() call. */ +// TODO Make this into an enum #define CWD_EXPAND 0 /* expand "." and ".." but don't resolve symlinks */ #define CWD_FILEPATH 1 /* resolve symlinks if file is exist otherwise expand */ #define CWD_REALPATH 2 /* call realpath(), resolve symlinks. File must exist */ From bcfa1f901e3274a5f3552d8e5932bab7ec0d1f5c Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 20:13:46 +0200 Subject: [PATCH 50/65] Boolify zend_weakref.c --- Zend/zend_weakrefs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index 8a444c214e9e1..e9133c694c6fa 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -340,6 +340,7 @@ static void zend_weakmap_write_dimension(zend_object *object, zval *offset, zval zend_hash_index_add_new(&wm->ht, (zend_ulong) obj_key, value); } +/* int return and check_empty due to Object Handler API */ static int zend_weakmap_has_dimension(zend_object *object, zval *offset, int check_empty) { if (Z_TYPE_P(offset) != IS_OBJECT) { @@ -371,7 +372,7 @@ static void zend_weakmap_unset_dimension(zend_object *object, zval *offset) zend_weakref_unregister(obj_key, ZEND_WEAKREF_ENCODE(wm, ZEND_WEAKREF_TAG_MAP)); } -static int zend_weakmap_count_elements(zend_object *object, zend_long *count) +static ZEND_RESULT_CODE zend_weakmap_count_elements(zend_object *object, zend_long *count) { zend_weakmap *wm = zend_weakmap_from(object); *count = zend_hash_num_elements(&wm->ht); @@ -503,6 +504,7 @@ static const zend_object_iterator_funcs zend_weakmap_iterator_funcs = { NULL, /* get_gc */ }; +/* by_ref is int due to Iterator API */ static zend_object_iterator *zend_weakmap_get_iterator( zend_class_entry *ce, zval *object, int by_ref) { From 7f20490a80f9295694bf82b628ea88700e0e40e7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 16 Aug 2020 20:06:18 +0200 Subject: [PATCH 51/65] Boolify zend_VM --- Zend/zend_vm_def.h | 32 +++--- Zend/zend_vm_execute.h | 216 ++++++++++++++++++++--------------------- 2 files changed, 124 insertions(+), 124 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 4d72cf31ad7a9..9f735c5a4c8ed 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -549,7 +549,7 @@ ZEND_VM_C_LABEL(is_equal_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -629,7 +629,7 @@ ZEND_VM_C_LABEL(is_not_equal_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -2993,7 +2993,7 @@ ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - int ret; + bool ret; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -3029,7 +3029,7 @@ ZEND_VM_COLD_CONST_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - int ret; + bool ret; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -4982,7 +4982,7 @@ ZEND_VM_C_LABEL(send_again): // TODO: Speed this up using a flag that specifies whether there are any ref parameters. if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_REFCOUNT_P(args) > 1) { uint32_t tmp_arg_num = arg_num; - int separate = 0; + bool separate = 0; /* check if any of arguments are going to be passed by reference */ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) { @@ -5591,7 +5591,7 @@ ZEND_VM_C_LABEL(case_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); FREE_OP2(); if (result) { ZEND_VM_C_GOTO(case_true); @@ -6950,7 +6950,7 @@ ZEND_VM_HOT_HANDLER(154, ZEND_ISSET_ISEMPTY_CV, CV, UNUSED, ISSET, SPEC(ISSET)) ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -7267,7 +7267,7 @@ ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR) USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -9206,7 +9206,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9218,7 +9218,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9230,7 +9230,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9242,7 +9242,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9283,7 +9283,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_i { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9295,7 +9295,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2 { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9307,7 +9307,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9319,7 +9319,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUB { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index a46b39d027a50..1e0bfabe381cd 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1870,7 +1870,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_ // TODO: Speed this up using a flag that specifies whether there are any ref parameters. if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_REFCOUNT_P(args) > 1) { uint32_t tmp_arg_num = arg_num; - int separate = 0; + bool separate = 0; /* check if any of arguments are going to be passed by reference */ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) { @@ -3554,7 +3554,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONS { USE_OPLINE zval *val; - int ret; + bool ret; val = RT_CONSTANT(opline, opline->op1); @@ -3590,7 +3590,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CON { USE_OPLINE zval *val; - int ret; + bool ret; val = RT_CONSTANT(opline, opline->op1); @@ -4300,7 +4300,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONS USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = RT_CONSTANT(opline, opline->op1); @@ -5016,7 +5016,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CON } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CONST & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -5074,7 +5074,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CONST & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -7248,7 +7248,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7260,7 +7260,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7272,7 +7272,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7284,7 +7284,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_T { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7296,7 +7296,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7308,7 +7308,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7320,7 +7320,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7332,7 +7332,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7344,7 +7344,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7356,7 +7356,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7368,7 +7368,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7380,7 +7380,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -11951,7 +11951,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CO { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11963,7 +11963,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11975,7 +11975,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11987,7 +11987,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11999,7 +11999,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12011,7 +12011,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12023,7 +12023,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12035,7 +12035,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12047,7 +12047,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12059,7 +12059,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12071,7 +12071,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12083,7 +12083,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12095,7 +12095,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12107,7 +12107,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12119,7 +12119,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12131,7 +12131,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12143,7 +12143,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12155,7 +12155,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12167,7 +12167,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12179,7 +12179,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12191,7 +12191,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12203,7 +12203,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12215,7 +12215,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12227,7 +12227,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12857,7 +12857,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TM { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12869,7 +12869,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12881,7 +12881,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12893,7 +12893,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12905,7 +12905,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12917,7 +12917,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12929,7 +12929,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12941,7 +12941,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12953,7 +12953,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12965,7 +12965,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12977,7 +12977,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12989,7 +12989,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13001,7 +13001,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13013,7 +13013,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13025,7 +13025,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13037,7 +13037,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13049,7 +13049,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13061,7 +13061,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13073,7 +13073,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13085,7 +13085,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13097,7 +13097,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13109,7 +13109,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13121,7 +13121,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13133,7 +13133,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13338,7 +13338,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE { USE_OPLINE zval *val; - int ret; + bool ret; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -13374,7 +13374,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(Z { USE_OPLINE zval *val; - int ret; + bool ret; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -14024,7 +14024,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HAN } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14082,7 +14082,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14140,7 +14140,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14198,7 +14198,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14256,7 +14256,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14314,7 +14314,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14981,7 +14981,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (result) { goto case_true; @@ -15444,7 +15444,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_HA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15502,7 +15502,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15560,7 +15560,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15618,7 +15618,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15676,7 +15676,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15734,7 +15734,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -16373,7 +16373,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLE } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); if (result) { goto case_true; @@ -17686,7 +17686,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZE } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (result) { goto case_true; @@ -18311,7 +18311,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_ USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -21184,7 +21184,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_ USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -36856,7 +36856,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_O { USE_OPLINE zval *val; - int ret; + bool ret; val = EX_VAR(opline->op1.var); @@ -36892,7 +36892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_ { USE_OPLINE zval *val; - int ret; + bool ret; val = EX_VAR(opline->op1.var); @@ -37551,7 +37551,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_O USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC); @@ -38257,7 +38257,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38315,7 +38315,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPZ_HA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38373,7 +38373,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPNZ_H } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38431,7 +38431,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HAN } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38489,7 +38489,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38547,7 +38547,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -41885,7 +41885,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_HANDLE } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -41943,7 +41943,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPZ_H } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42001,7 +42001,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPNZ_ } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42059,7 +42059,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_HA } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42117,7 +42117,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42175,7 +42175,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -46290,7 +46290,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -46312,7 +46312,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -46939,7 +46939,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZE } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -46997,7 +46997,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPZ_HANDL } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47055,7 +47055,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPNZ_HAND } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47113,7 +47113,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLE } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47171,7 +47171,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPZ_H } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47229,7 +47229,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPNZ_ } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } From ce59e42e147840c1e960750b90721520320eeb8c Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 17 Aug 2020 00:55:10 +0200 Subject: [PATCH 52/65] Zend_API.h slight teak --- Zend/zend_API.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index feaeab2ea67c4..5f3d9b8553087 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1176,7 +1176,7 @@ static zend_always_inline zval *zend_try_array_init_size(zval *zv, uint32_t size if (EXPECTED(Z_ISREF_P(zv))) { zend_reference *ref = Z_REF_P(zv); if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { - if (zend_try_assign_typed_ref_arr(ref, arr) != SUCCESS) { + if (zend_try_assign_typed_ref_arr(ref, arr) == FAILURE) { return NULL; } return &ref->val; From 32149e494f41c65199a498a6601b4d798d6f4797 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 17 Aug 2020 01:24:21 +0200 Subject: [PATCH 53/65] Fix zend_extension incompatible function pointer --- Zend/zend_extensions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 8ea36e081282f..a547ede770071 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -180,7 +180,8 @@ static void zend_extension_shutdown(zend_extension *extension) #endif } -static bool zend_extension_startup(zend_extension *extension) +/* int return due to zend linked list API */ +static int zend_extension_startup(zend_extension *extension) { #if ZEND_EXTENSIONS_SUPPORT if (extension->startup) { From 0001c4bc1493cb1e295cebbab04d92d6f98854c9 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 17 Aug 2020 01:40:41 +0200 Subject: [PATCH 54/65] Fix zend_stream function to be compatible for Zend LList --- Zend/zend_stream.c | 3 ++- Zend/zend_stream.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 87d90a7b9869c..18419457b1376 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -232,7 +232,8 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */ } /* }}} */ -ZEND_API bool zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ +/* return int to be compatible with Zend linked list API */ +ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ { if (fh1->type != fh2->type) { return 0; diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 3f7df9d4e2ba9..57ddc3df15f43 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -69,7 +69,7 @@ ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *fi ZEND_API ZEND_RESULT_CODE zend_stream_open(const char *filename, zend_file_handle *handle); ZEND_API ZEND_RESULT_CODE zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); -ZEND_API bool zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); +ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); END_EXTERN_C() #ifdef ZEND_WIN32 From 06c577928bc9f73a44f6caa0a5b6e7185ae67867 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 18 Aug 2020 19:59:42 +0200 Subject: [PATCH 55/65] Fix zend_module_entry enum due to zend_API changes --- Zend/zend_modules.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index c7e279a40849d..05f7085190c8f 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -77,10 +77,10 @@ struct _zend_module_entry { const struct _zend_module_dep *deps; const char *name; const struct _zend_function_entry *functions; - int (*module_startup_func)(INIT_FUNC_ARGS); - int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - int (*request_startup_func)(INIT_FUNC_ARGS); - int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); + ZEND_RESULT_CODE (*module_startup_func)(INIT_FUNC_ARGS); + ZEND_RESULT_CODE (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); + ZEND_RESULT_CODE (*request_startup_func)(INIT_FUNC_ARGS); + ZEND_RESULT_CODE (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); const char *version; size_t globals_size; From 45aef0fe4b1f3c7e927c073046f857f889faac16 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 20 Aug 2020 11:26:00 +0200 Subject: [PATCH 56/65] Fix incompatible pointer error for Zend object handlers. --- Zend/zend_compile.h | 4 ++-- Zend/zend_exceptions.c | 4 ++-- Zend/zend_generators.c | 2 +- Zend/zend_interfaces.c | 18 +++++++++--------- Zend/zend_interfaces.h | 8 ++++---- Zend/zend_weakrefs.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 1010a250276f3..6dee886022832 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -751,8 +751,8 @@ const char *zend_get_zendtext(void); int zend_get_zendleng(void); #endif -typedef int (ZEND_FASTCALL *unary_op_type)(zval *, zval *); -typedef int (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); +typedef ZEND_RESULT_CODE (ZEND_FASTCALL *unary_op_type)(zval *, zval *); +typedef ZEND_RESULT_CODE (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); ZEND_API unary_op_type get_unary_op(int opcode); ZEND_API binary_op_type get_binary_op(int opcode); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 7d709882eedce..ee3a63a50ddeb 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -1,4 +1,4 @@ -/* + /* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ @@ -50,7 +50,7 @@ ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); static zend_object_handlers default_exception_handlers; /* {{{ zend_implement_throwable */ -static ZEND_RESULT_CODE zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) +static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { if (instanceof_function(class_type, zend_ce_exception) || instanceof_function(class_type, zend_ce_error)) { return SUCCESS; diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index f9a8fb4c09b2f..590508dd4f474 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -1027,7 +1027,7 @@ static void zend_generator_iterator_dtor(zend_object_iterator *iterator) /* {{{ } /* }}} */ -static ZEND_RESULT_CODE zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */ +static int zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */ { zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 280af1cc3c41f..3d44b4769b29b 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -118,7 +118,7 @@ static void zend_user_it_dtor(zend_object_iterator *_iter) /* }}} */ /* {{{ zend_user_it_valid */ -ZEND_API ZEND_RESULT_CODE zend_user_it_valid(zend_object_iterator *_iter) +ZEND_API int zend_user_it_valid(zend_object_iterator *_iter) { if (_iter) { zend_user_iterator *iter = (zend_user_iterator*)_iter; @@ -251,7 +251,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c /* }}} */ /* {{{ zend_implement_traversable */ -static ZEND_RESULT_CODE zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) +static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) { /* Abstract class can implement Traversable only, in which case the extending class must * implement Iterator or IteratorAggregate. */ @@ -278,7 +278,7 @@ static ZEND_RESULT_CODE zend_implement_traversable(zend_class_entry *interface, /* }}} */ /* {{{ zend_implement_aggregate */ -static ZEND_RESULT_CODE zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) +static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_iterator)) { zend_error_noreturn(E_ERROR, @@ -318,7 +318,7 @@ static ZEND_RESULT_CODE zend_implement_aggregate(zend_class_entry *interface, ze /* }}} */ /* {{{ zend_implement_iterator */ -static ZEND_RESULT_CODE zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) +static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_aggregate)) { zend_error_noreturn(E_ERROR, @@ -354,7 +354,7 @@ static ZEND_RESULT_CODE zend_implement_iterator(zend_class_entry *interface, zen /* }}} */ /* {{{ zend_user_serialize */ -ZEND_API ZEND_RESULT_CODE zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) { zend_class_entry * ce = Z_OBJCE_P(object); zval retval; @@ -391,7 +391,7 @@ ZEND_API ZEND_RESULT_CODE zend_user_serialize(zval *object, unsigned char **buff /* }}} */ /* {{{ zend_user_unserialize */ -ZEND_API ZEND_RESULT_CODE zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) +ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) { zval zdata; @@ -412,7 +412,7 @@ ZEND_API ZEND_RESULT_CODE zend_user_unserialize(zval *object, zend_class_entry * } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ZSTR_VAL(ce->name)); @@ -420,7 +420,7 @@ ZEND_API ZEND_RESULT_CODE zend_class_serialize_deny(zval *object, unsigned char } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ +ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ { zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ZSTR_VAL(ce->name)); return FAILURE; @@ -428,7 +428,7 @@ ZEND_API ZEND_RESULT_CODE zend_class_unserialize_deny(zval *object, zend_class_e /* }}} */ /* {{{ zend_implement_serializable */ -static ZEND_RESULT_CODE zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->parent && (class_type->parent->serialize || class_type->parent->unserialize) diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index bbc4ac5b49fda..2f09402c90e5c 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -72,11 +72,11 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c ZEND_API void zend_register_interfaces(void); -ZEND_API ZEND_RESULT_CODE zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); -ZEND_API ZEND_RESULT_CODE zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); +ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); -ZEND_API ZEND_RESULT_CODE zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); -ZEND_API ZEND_RESULT_CODE zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); +ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); ZEND_API ZEND_RESULT_CODE zend_create_internal_iterator_zval(zval *return_value, zval *obj); diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index e9133c694c6fa..a4bf195a07060 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -372,7 +372,7 @@ static void zend_weakmap_unset_dimension(zend_object *object, zval *offset) zend_weakref_unregister(obj_key, ZEND_WEAKREF_ENCODE(wm, ZEND_WEAKREF_TAG_MAP)); } -static ZEND_RESULT_CODE zend_weakmap_count_elements(zend_object *object, zend_long *count) +static int zend_weakmap_count_elements(zend_object *object, zend_long *count) { zend_weakmap *wm = zend_weakmap_from(object); *count = zend_hash_num_elements(&wm->ht); From 4f8829ac17304fa491ff51eee7a221e115c393d0 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 20 Aug 2020 17:51:50 +0200 Subject: [PATCH 57/65] Fix OpCache --- ext/opcache/ZendAccelerator.c | 18 +++++++++--------- ext/opcache/ZendAccelerator.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index f532596f0f9a7..9bd2ab15e1386 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -119,15 +119,15 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */ #endif static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); -static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); +static ZEND_RESULT_CODE (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len); static void (*accelerator_orig_zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); static zif_handler orig_chdir = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; -static int (*orig_post_startup_cb)(void); +static ZEND_RESULT_CODE (*orig_post_startup_cb)(void); static void accel_gen_system_id(void); -static int accel_post_startup(void); +static ZEND_RESULT_CODE accel_post_startup(void); static int accel_finish_startup(void); static void preload_shutdown(void); @@ -304,7 +304,7 @@ static inline int accel_restart_is_active(void) } /* Creates a read lock for SHM access */ -static inline int accel_activate_add(void) +static inline ZEND_RESULT_CODE accel_activate_add(void) { #ifdef ZEND_WIN32 SHM_UNPROTECT(); @@ -2269,7 +2269,7 @@ static int accel_gen_uname_id(void) #endif /* zend_stream_open_function() replacement for PHP 5.3 and above */ -static int persistent_stream_open_function(const char *filename, zend_file_handle *handle) +static ZEND_RESULT_CODE persistent_stream_open_function(const char *filename, zend_file_handle *handle) { if (ZCG(cache_persistent_script)) { /* check if callback is called from include_once or it's a main request */ @@ -2400,7 +2400,7 @@ static void accel_reset_pcre_cache(void) } ZEND_HASH_FOREACH_END(); } -int accel_activate(INIT_FUNC_ARGS) +ZEND_RESULT_CODE accel_activate(INIT_FUNC_ARGS) { if (!ZCG(enabled) || !accel_startup_ok) { ZCG(accelerator_enabled) = 0; @@ -2963,13 +2963,13 @@ static int accel_startup(zend_extension *extension) return SUCCESS; } -static int accel_post_startup(void) +static ZEND_RESULT_CODE accel_post_startup(void) { zend_function *func; zend_ini_entry *ini_entry; if (orig_post_startup_cb) { - int (*cb)(void) = orig_post_startup_cb; + ZEND_RESULT_CODE (*cb)(void) = orig_post_startup_cb; orig_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -4368,7 +4368,7 @@ static void preload_load(void) } } -static int preload_autoload(zend_string *filename) +static ZEND_RESULT_CODE preload_autoload(zend_string *filename) { zend_persistent_script *persistent_script; zend_op_array *op_array; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 05a05fa1b68a4..a0749cb22d33a 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -316,7 +316,7 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; void accel_shutdown(void); -int accel_activate(INIT_FUNC_ARGS); +ZEND_RESULT_CODE accel_activate(INIT_FUNC_ARGS); int accel_post_deactivate(void); void zend_accel_schedule_restart(zend_accel_restart_reason reason); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); From d276dceca84b663f18214e434c6226e59ffdac14 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 22 Aug 2020 00:50:34 +0200 Subject: [PATCH 58/65] Shot in the dark to fix the JIT --- Zend/zend_operators.c | 4 ++-- Zend/zend_operators.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 9e91069e78b7c..fea8ae3340275 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2524,13 +2524,13 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ +ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ { return i_zend_is_true(op); } /* }}} */ -ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ +ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ { zend_object *zobj = Z_OBJ_P(op); zval tmp; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 76d0749703ee0..4c09ce3761624 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -341,15 +341,15 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); } -ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op); -ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op); +ZEND_API int ZEND_FASTCALL zend_is_true(zval *op); +ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op); #define zval_is_true(op) \ zend_is_true(op) -static zend_always_inline bool i_zend_is_true(zval *op) +static zend_always_inline int i_zend_is_true(zval *op) { - bool result = 0; + int result = 0; again: switch (Z_TYPE_P(op)) { From 39cc10b838505aba65e3160720f452d8a5e278fd Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 24 Aug 2020 14:43:42 +0200 Subject: [PATCH 59/65] Typedef ZEND_RESULT_CODE to zend_result --- Zend/zend_types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 7796979ed842f..745be6e93830c 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -55,6 +55,8 @@ typedef enum { FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */ } ZEND_RESULT_CODE; +typedef ZEND_RESULT_CODE zend_result; + #ifdef ZEND_ENABLE_ZVAL_LONG64 # ifdef ZEND_WIN32 # define ZEND_SIZE_MAX _UI64_MAX From b548cdbde6077449ce250e682cfceba29705c485 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 24 Aug 2020 14:52:42 +0200 Subject: [PATCH 60/65] Use zend_result instead of ZEND_RESULT_CODE --- Zend/zend.c | 14 ++-- Zend/zend.h | 10 +-- Zend/zend_API.c | 128 ++++++++++++++++---------------- Zend/zend_API.h | 134 +++++++++++++++++----------------- Zend/zend_ast.c | 8 +- Zend/zend_ast.h | 2 +- Zend/zend_attributes.c | 2 +- Zend/zend_attributes.h | 2 +- Zend/zend_builtin_functions.c | 2 +- Zend/zend_builtin_functions.h | 2 +- Zend/zend_closures.c | 2 +- Zend/zend_compile.c | 54 +++++++------- Zend/zend_compile.h | 12 +-- Zend/zend_constants.c | 6 +- Zend/zend_constants.h | 2 +- Zend/zend_exceptions.c | 4 +- Zend/zend_exceptions.h | 2 +- Zend/zend_execute.c | 22 +++--- Zend/zend_execute.h | 16 ++-- Zend/zend_execute_API.c | 28 +++---- Zend/zend_extensions.c | 4 +- Zend/zend_extensions.h | 4 +- Zend/zend_generators.c | 2 +- Zend/zend_hash.c | 14 ++-- Zend/zend_hash.h | 26 +++---- Zend/zend_highlight.h | 2 +- Zend/zend_inheritance.c | 2 +- Zend/zend_inheritance.h | 2 +- Zend/zend_ini.c | 22 +++--- Zend/zend_ini.h | 14 ++-- Zend/zend_ini_parser.y | 4 +- Zend/zend_ini_scanner.h | 4 +- Zend/zend_ini_scanner.l | 8 +- Zend/zend_interfaces.c | 6 +- Zend/zend_interfaces.h | 4 +- Zend/zend_language_scanner.h | 4 +- Zend/zend_language_scanner.l | 14 ++-- Zend/zend_list.c | 2 +- Zend/zend_modules.h | 8 +- Zend/zend_multibyte.c | 12 +-- Zend/zend_multibyte.h | 8 +- Zend/zend_operators.c | 68 ++++++++--------- Zend/zend_operators.h | 50 ++++++------- Zend/zend_signal.c | 2 +- Zend/zend_stream.c | 4 +- Zend/zend_stream.h | 4 +- Zend/zend_ts_hash.c | 8 +- Zend/zend_ts_hash.h | 4 +- Zend/zend_virtual_cwd.c | 2 +- ext/mbstring/mbstring.c | 8 +- ext/opcache/ZendAccelerator.c | 18 ++--- ext/opcache/ZendAccelerator.h | 2 +- main/main.c | 4 +- 53 files changed, 396 insertions(+), 396 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 354b9c3c5ea16..2e2ff032136bc 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -74,7 +74,7 @@ ZEND_API zend_class_entry *zend_standard_class_def = NULL; ZEND_API size_t (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path); -ZEND_API ZEND_RESULT_CODE (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +ZEND_API zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); ZEND_API void (*zend_ticks_function)(int ticks); ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); @@ -82,9 +82,9 @@ void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_li void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); -ZEND_API ZEND_RESULT_CODE (*zend_post_startup_cb)(void) = NULL; +ZEND_API zend_result (*zend_post_startup_cb)(void) = NULL; ZEND_API void (*zend_post_shutdown_cb)(void) = NULL; -ZEND_API ZEND_RESULT_CODE (*zend_preload_autoload)(zend_string *filename) = NULL; +ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename) = NULL; /* This callback must be signal handler safe! */ void (*zend_on_timeout)(int seconds); @@ -1018,7 +1018,7 @@ static void zend_resolve_property_types(void) /* {{{ */ /* Unlink the global (r/o) copies of the class, function and constant tables, * and use a fresh r/w copy for the startup thread */ -ZEND_RESULT_CODE zend_post_startup(void) /* {{{ */ +zend_result zend_post_startup(void) /* {{{ */ { #ifdef ZTS zend_encoding **script_encoding_list; @@ -1030,7 +1030,7 @@ ZEND_RESULT_CODE zend_post_startup(void) /* {{{ */ zend_resolve_property_types(); if (zend_post_startup_cb) { - ZEND_RESULT_CODE (*cb)(void) = zend_post_startup_cb; + zend_result (*cb)(void) = zend_post_startup_cb; zend_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -1662,13 +1662,13 @@ ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */ } } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ +ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ { va_list files; int i; zend_file_handle *file_handle; zend_op_array *op_array; - ZEND_RESULT_CODE ret = SUCCESS; + zend_result ret = SUCCESS; va_start(files, file_count); for (i = 0; i < file_count; i++) { diff --git a/Zend/zend.h b/Zend/zend.h index fba45e0270c1d..0a0506f9158a1 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -195,7 +195,7 @@ typedef struct _zend_utility_functions { zval *(*get_configuration_directive)(zend_string *name); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds); - ZEND_RESULT_CODE (*stream_open_function)(const char *filename, zend_file_handle *handle); + zend_result (*stream_open_function)(const char *filename, zend_file_handle *handle); void (*printf_to_smart_string_function)(smart_string *buf, const char *format, va_list ap); void (*printf_to_smart_str_function)(smart_str *buf, const char *format, va_list ap); char *(*getenv_function)(const char *name, size_t name_len); @@ -230,7 +230,7 @@ BEGIN_EXTERN_C() void zend_startup(zend_utility_functions *utility_functions); void zend_shutdown(void); void zend_register_standard_ini_entries(void); -ZEND_RESULT_CODE zend_post_startup(void); +zend_result zend_post_startup(void); void zend_set_utility_values(zend_utility_values *utility_values); ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno); @@ -283,18 +283,18 @@ extern ZEND_API void (*zend_ticks_function)(int ticks); extern ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); extern ZEND_API void (*zend_on_timeout)(int seconds); -extern ZEND_API ZEND_RESULT_CODE (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +extern ZEND_API zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); extern void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap); extern void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); /* These two callbacks are especially for opcache */ -extern ZEND_API ZEND_RESULT_CODE (*zend_post_startup_cb)(void); +extern ZEND_API zend_result (*zend_post_startup_cb)(void); extern ZEND_API void (*zend_post_shutdown_cb)(void); /* Callback for loading of not preloaded part of the script */ -extern ZEND_API ZEND_RESULT_CODE (*zend_preload_autoload)(zend_string *filename); +extern ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename); ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 98905939c142e..1e5dfe57b038d 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -42,7 +42,7 @@ static zend_module_entry **module_post_deactivate_handlers; static zend_class_entry **class_cleanup_handlers; -ZEND_API ZEND_RESULT_CODE _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -64,7 +64,7 @@ ZEND_API ZEND_RESULT_CODE _zend_get_parameters_array_ex(uint32_t param_count, zv } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -858,7 +858,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } /* }}} */ -static ZEND_RESULT_CODE zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ +static zend_result zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ { const char *expected_type = NULL; char *error = NULL; @@ -886,10 +886,10 @@ static ZEND_RESULT_CODE zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) +ZEND_API zend_result zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) { va_list va; - ZEND_RESULT_CODE ret; + zend_result ret; va_start(va, spec); ret = zend_parse_arg(arg_num, arg, &va, &spec, flags); @@ -907,7 +907,7 @@ static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { ZSTR_VAL(active_function->common.function_name), msg); } -static ZEND_RESULT_CODE zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ +static zend_result zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ { const char *spec_walk; char c; @@ -1049,10 +1049,10 @@ static ZEND_RESULT_CODE zend_parse_va_args(uint32_t num_args, const char *type_s } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - ZEND_RESULT_CODE retval; + zend_result retval; va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags); @@ -1062,10 +1062,10 @@ ZEND_API ZEND_RESULT_CODE zend_parse_parameters_ex(int flags, uint32_t num_args, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - ZEND_RESULT_CODE retval; + zend_result retval; int flags = 0; va_start(va, type_spec); @@ -1076,10 +1076,10 @@ ZEND_API ZEND_RESULT_CODE zend_parse_parameters(uint32_t num_args, const char *t } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - ZEND_RESULT_CODE retval; + zend_result retval; int flags = 0; const char *p = type_spec; zval **object; @@ -1116,10 +1116,10 @@ ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters(uint32_t num_args, zval * } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - ZEND_RESULT_CODE retval; + zend_result retval; const char *p = type_spec; zval **object; zend_class_entry *ce; @@ -1172,7 +1172,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ +ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ { if (!(class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) { zend_class_constant *c; @@ -1361,7 +1361,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties) * class and all props being public. If only a subset is given or the class * has protected members then you need to merge the properties separately by * calling zend_merge_properties(). */ -static zend_always_inline ZEND_RESULT_CODE _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +static zend_always_inline zend_result _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { @@ -1400,13 +1400,13 @@ static zend_always_inline ZEND_RESULT_CODE _object_and_properties_init(zval *arg } /* }}} */ -ZEND_API ZEND_RESULT_CODE object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +ZEND_API zend_result object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { return _object_and_properties_init(arg, class_type, properties); } /* }}} */ -ZEND_API ZEND_RESULT_CODE object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ +ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ { return _object_and_properties_init(arg, class_type, NULL); } @@ -1568,7 +1568,7 @@ ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, si } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_long(zval *arg, zend_long n) /* {{{ */ +ZEND_API zend_result add_next_index_long(zval *arg, zend_long n) /* {{{ */ { zval tmp; @@ -1577,7 +1577,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_long(zval *arg, zend_long n) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_null(zval *arg) /* {{{ */ +ZEND_API zend_result add_next_index_null(zval *arg) /* {{{ */ { zval tmp; @@ -1586,7 +1586,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_null(zval *arg) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ +ZEND_API zend_result add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ { zval tmp; @@ -1595,7 +1595,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ +ZEND_API zend_result add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ { zval tmp; @@ -1604,7 +1604,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_resource(zval *arg, zend_resource *r) / } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_double(zval *arg, double d) /* {{{ */ +ZEND_API zend_result add_next_index_double(zval *arg, double d) /* {{{ */ { zval tmp; @@ -1613,7 +1613,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_double(zval *arg, double d) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_str(zval *arg, zend_string *str) /* {{{ */ +ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str) /* {{{ */ { zval tmp; @@ -1622,7 +1622,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_str(zval *arg, zend_string *str) /* {{{ } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_string(zval *arg, const char *str) /* {{{ */ +ZEND_API zend_result add_next_index_string(zval *arg, const char *str) /* {{{ */ { zval tmp; @@ -1631,7 +1631,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_string(zval *arg, const char *str) /* { } /* }}} */ -ZEND_API ZEND_RESULT_CODE add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ +ZEND_API zend_result add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ { zval tmp; @@ -1640,7 +1640,7 @@ ZEND_API ZEND_RESULT_CODE add_next_index_stringl(zval *arg, const char *str, siz } /* }}} */ -ZEND_API ZEND_RESULT_CODE array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ +ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ { zval *result; @@ -1767,7 +1767,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_startup_module_ex(zend_module_entry *module) /* {{{ */ +ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module) /* {{{ */ { size_t name_len; zend_string *lcname; @@ -2254,7 +2254,7 @@ ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, z } /* registers all functions in *library_functions in the function hash */ -ZEND_API ZEND_RESULT_CODE zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ +ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ { const zend_function_entry *ptr = functions; zend_function function, *reg_function; @@ -2477,7 +2477,7 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_startup_module(zend_module_entry *module) /* {{{ */ +ZEND_API zend_result zend_startup_module(zend_module_entry *module) /* {{{ */ { if ((module = zend_register_internal_module(module)) != NULL && zend_startup_module_ex(module) == SUCCESS) { return SUCCESS; @@ -2486,7 +2486,7 @@ ZEND_API ZEND_RESULT_CODE zend_startup_module(zend_module_entry *module) /* {{{ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_get_module_started(const char *module_name) /* {{{ */ +ZEND_API zend_result zend_get_module_started(const char *module_name) /* {{{ */ { zend_module_entry *module; @@ -2730,7 +2730,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent) /* {{{ */ +ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent) /* {{{ */ { zend_string *lcname; zval zv, *ret; @@ -2766,7 +2766,7 @@ ZEND_API ZEND_RESULT_CODE zend_register_class_alias_ex(const char *name, size_t /* }}} */ // TODO num_symbol_tables as unsigned int? -ZEND_API ZEND_RESULT_CODE zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +ZEND_API zend_result zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ { HashTable *symbol_table; va_list symbol_table_list; @@ -2790,7 +2790,7 @@ ZEND_API ZEND_RESULT_CODE zend_set_hash_symbol(zval *symbol, const char *name, s /* Disabled functions support */ -ZEND_API ZEND_RESULT_CODE zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ +ZEND_API zend_result zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ { return zend_hash_str_del(CG(function_table), function_name, function_name_length); } @@ -2827,7 +2827,7 @@ static const zend_function_entry disabled_class_new[] = { ZEND_FE_END }; -ZEND_API ZEND_RESULT_CODE zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ +ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ { zend_class_entry *disabled_class; zend_string *key; @@ -3391,7 +3391,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ +ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ { if (!zend_is_callable_ex(callable, NULL, check_flags, callable_name, fcc, error)) { return FAILURE; @@ -3445,7 +3445,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ { zval *arg, *params; uint32_t n = 1; @@ -3478,7 +3478,7 @@ ZEND_API ZEND_RESULT_CODE zend_fcall_info_args_ex(zend_fcall_info *fci, zend_fun } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ { return zend_fcall_info_args_ex(fci, NULL, args); } @@ -3526,11 +3526,11 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...) /* } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ { zval retval, *org_params = NULL; uint32_t org_count = 0; - ZEND_RESULT_CODE result; + zend_result result; fci->retval = retval_ptr ? retval_ptr : &retval; if (args) { @@ -3681,7 +3681,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ { if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, val, strict))) { zval_ptr_dtor(val); @@ -3694,13 +3694,13 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_ex(zend_reference *ref, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ { return zend_try_assign_typed_ref_ex(ref, val, ZEND_ARG_USES_STRICT_TYPES()); } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3709,7 +3709,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_null(zend_reference *ref) /* } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ { zval tmp; @@ -3718,7 +3718,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_bool(zend_reference *ref, ze } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ { zval tmp; @@ -3727,7 +3727,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_long(zend_reference *ref, ze } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ { zval tmp; @@ -3736,7 +3736,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_double(zend_reference *ref, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3745,7 +3745,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_empty_string(zend_reference } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ { zval tmp; @@ -3754,7 +3754,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_str(zend_reference *ref, zen } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ { zval tmp; @@ -3763,7 +3763,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_string(zend_reference *ref, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ { zval tmp; @@ -3772,7 +3772,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_stringl(zend_reference *ref, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ { zval tmp; @@ -3781,7 +3781,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_arr(zend_reference *ref, zen } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ { zval tmp; @@ -3790,7 +3790,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_res(zend_reference *ref, zen } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ { zval tmp; @@ -3799,7 +3799,7 @@ ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval(zend_reference *ref, zv } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ { zval tmp; @@ -4090,7 +4090,7 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ { zval *property, tmp; zend_property_info *prop_info; @@ -4126,7 +4126,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ { zend_string *key = zend_string_init(name, name_length, 0); bool retval = zend_update_static_property_ex(scope, key, value); @@ -4135,7 +4135,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, c } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ +ZEND_API zend_result zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ { zval tmp; @@ -4144,7 +4144,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_null(zend_class_entry *sco } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4153,7 +4153,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_bool(zend_class_entry *sco } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4162,7 +4162,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_long(zend_class_entry *sco } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ { zval tmp; @@ -4171,7 +4171,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_double(zend_class_entry *s } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ { zval tmp; @@ -4181,7 +4181,7 @@ ZEND_API ZEND_RESULT_CODE zend_update_static_property_string(zend_class_entry *s } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ +ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ { zval tmp; @@ -4315,7 +4315,7 @@ ZEND_API zend_bool zend_is_countable(zval *countable) /* {{{ */ } /* }}} */ -static ZEND_RESULT_CODE get_default_via_ast(zval *default_value_zval, const char *default_value) { +static zend_result get_default_via_ast(zval *default_value_zval, const char *default_value) { zend_ast *ast; zend_arena *ast_arena; @@ -4363,7 +4363,7 @@ static zend_string *try_parse_string(const char *str, size_t len, char quote) { return zend_string_init(str, len, 0); } -ZEND_API ZEND_RESULT_CODE zend_get_default_from_internal_arg_info( +ZEND_API zend_result zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info) { const char *default_value = arg_info->default_value; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 5f3d9b8553087..6d588cc90075d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -182,11 +182,11 @@ typedef struct _zend_fcall_info_cache { #define ZEND_MODULE_GLOBALS_DTOR_N(module) zm_globals_dtor_##module /* Declaration macros */ -#define ZEND_MODULE_STARTUP_D(module) ZEND_RESULT_CODE ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_SHUTDOWN_D(module) ZEND_RESULT_CODE ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_ACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_DEACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) ZEND_RESULT_CODE ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) +#define ZEND_MODULE_STARTUP_D(module) zend_result ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_SHUTDOWN_D(module) zend_result ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_ACTIVATE_D(module) zend_result ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_DEACTIVATE_D(module) zend_result ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) zend_result ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) #define ZEND_MODULE_INFO_D(module) ZEND_COLD void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS) #define ZEND_MODULE_GLOBALS_CTOR_D(module) void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals) #define ZEND_MODULE_GLOBALS_DTOR_D(module) void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals) @@ -283,10 +283,10 @@ typedef struct _zend_fcall_info_cache { ZEND_API int zend_next_free_module(void); BEGIN_EXTERN_C() -ZEND_API ZEND_RESULT_CODE _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); +ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); /* internal function to efficiently copy parameters when executing __call() */ -ZEND_API ZEND_RESULT_CODE zend_copy_parameters_array(uint32_t param_count, zval *argument_array); +ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array); #define zend_get_parameters_array(ht, param_count, argument_array) \ _zend_get_parameters_array_ex(param_count, argument_array) @@ -301,27 +301,27 @@ ZEND_API ZEND_RESULT_CODE zend_copy_parameters_array(uint32_t param_count, zval #define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */ #define ZEND_PARSE_PARAMS_QUIET (1<<1) -ZEND_API ZEND_RESULT_CODE zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); -ZEND_API ZEND_RESULT_CODE zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); +ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); +ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); /* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */ #define zend_parse_parameters_throw(num_args, ...) \ zend_parse_parameters(num_args, __VA_ARGS__) ZEND_API const char *zend_zval_type_name(const zval *arg); ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg); -ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API ZEND_RESULT_CODE zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API ZEND_RESULT_CODE zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); +ZEND_API zend_result zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); /* End of parameter parsing API -- andrei */ -ZEND_API ZEND_RESULT_CODE zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); +ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table); -ZEND_API ZEND_RESULT_CODE zend_startup_module(zend_module_entry *module_entry); +ZEND_API zend_result zend_startup_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module); -ZEND_API ZEND_RESULT_CODE zend_startup_module_ex(zend_module_entry *module); +ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module); ZEND_API void zend_startup_modules(void); ZEND_API void zend_collect_module_handlers(void); ZEND_API void zend_destroy_modules(void); @@ -334,15 +334,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry); ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_interfaces, ...); -ZEND_API ZEND_RESULT_CODE zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent); +ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent); #define zend_register_class_alias(name, ce) \ zend_register_class_alias_ex(name, sizeof(name)-1, ce, 1) #define zend_register_ns_class_alias(ns, name, ce) \ zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce, 1) -ZEND_API ZEND_RESULT_CODE zend_disable_function(const char *function_name, size_t function_name_length); -ZEND_API ZEND_RESULT_CODE zend_disable_class(const char *class_name, size_t class_name_length); +ZEND_API zend_result zend_disable_function(const char *function_name, size_t function_name_length); +ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_name_length); ZEND_API ZEND_COLD void zend_wrong_param_count(void); @@ -378,7 +378,7 @@ ZEND_API void zend_declare_class_constant_double(zend_class_entry *ce, const cha ZEND_API void zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value); -ZEND_API ZEND_RESULT_CODE zend_update_class_constants(zend_class_entry *class_type); +ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type); ZEND_API void zend_update_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zval *value); ZEND_API void zend_update_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zval *value); @@ -391,14 +391,14 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zend_object * ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_unset_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); -ZEND_API ZEND_RESULT_CODE zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); +ZEND_API zend_result zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); +ZEND_API zend_result zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); +ZEND_API zend_result zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); +ZEND_API zend_result zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API zend_result zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); +ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); +ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zend_bool silent, zval *rv); ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zend_bool silent, zval *rv); @@ -426,8 +426,8 @@ ZEND_API const char *zend_get_type_by_const(int type); #define array_init(arg) ZVAL_ARR((arg), zend_new_array(0)) #define array_init_size(arg, size) ZVAL_ARR((arg), zend_new_array(size)) ZEND_API void object_init(zval *arg); -ZEND_API ZEND_RESULT_CODE object_init_ex(zval *arg, zend_class_entry *ce); -ZEND_API ZEND_RESULT_CODE object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); +ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *ce); +ZEND_API zend_result object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type); ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties); ZEND_API void object_properties_load(zend_object *object, HashTable *properties); @@ -463,26 +463,26 @@ ZEND_API void add_index_str(zval *arg, zend_ulong index, zend_string *str); ZEND_API void add_index_string(zval *arg, zend_ulong index, const char *str); ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length); -static zend_always_inline ZEND_RESULT_CODE add_index_zval(zval *arg, zend_ulong index, zval *value) +static zend_always_inline zend_result add_index_zval(zval *arg, zend_ulong index, zval *value) { return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE; } -ZEND_API ZEND_RESULT_CODE add_next_index_long(zval *arg, zend_long n); -ZEND_API ZEND_RESULT_CODE add_next_index_null(zval *arg); -ZEND_API ZEND_RESULT_CODE add_next_index_bool(zval *arg, zend_bool b); -ZEND_API ZEND_RESULT_CODE add_next_index_resource(zval *arg, zend_resource *r); -ZEND_API ZEND_RESULT_CODE add_next_index_double(zval *arg, double d); -ZEND_API ZEND_RESULT_CODE add_next_index_str(zval *arg, zend_string *str); -ZEND_API ZEND_RESULT_CODE add_next_index_string(zval *arg, const char *str); -ZEND_API ZEND_RESULT_CODE add_next_index_stringl(zval *arg, const char *str, size_t length); +ZEND_API zend_result add_next_index_long(zval *arg, zend_long n); +ZEND_API zend_result add_next_index_null(zval *arg); +ZEND_API zend_result add_next_index_bool(zval *arg, zend_bool b); +ZEND_API zend_result add_next_index_resource(zval *arg, zend_resource *r); +ZEND_API zend_result add_next_index_double(zval *arg, double d); +ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str); +ZEND_API zend_result add_next_index_string(zval *arg, const char *str); +ZEND_API zend_result add_next_index_stringl(zval *arg, const char *str, size_t length); -static zend_always_inline ZEND_RESULT_CODE add_next_index_zval(zval *arg, zval *value) +static zend_always_inline zend_result add_next_index_zval(zval *arg, zval *value) { return zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE; } -ZEND_API ZEND_RESULT_CODE array_set_zval_key(HashTable *ht, zval *key, zval *value); +ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value); ZEND_API void add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l); ZEND_API void add_property_null_ex(zval *arg, const char *key, size_t key_len); @@ -505,7 +505,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value) -ZEND_API ZEND_RESULT_CODE _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); +ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); #define call_user_function(function_table, object, function_name, retval_ptr, param_count, params) \ _call_user_function_impl(object, function_name, retval_ptr, param_count, params, NULL) @@ -524,7 +524,7 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->params = NULL; * The callable_name argument may be NULL. */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); +ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); /** Clear arguments connected with zend_fcall_info *fci * If free_mem is not zero then the params array gets free'd as well @@ -543,8 +543,8 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ /** Set or clear the arguments in the zend_call_info struct taking care of * refcount. If args is NULL and arguments are set then those are cleared. */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_args(zend_fcall_info *fci, zval *args); -ZEND_API ZEND_RESULT_CODE zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); +ZEND_API zend_result zend_fcall_info_args(zend_fcall_info *fci, zval *args); +ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); /** Set arguments in the zend_fcall_info struct taking care of refcount. * If argc is 0 the arguments which are set will be cleared, else pass @@ -567,9 +567,9 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...); /** Call a function using information created by zend_fcall_info_init()/args(). * If args is given then those replace the argument info in fci is temporarily. */ -ZEND_API ZEND_RESULT_CODE zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); +ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); -ZEND_API ZEND_RESULT_CODE zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); +ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); /* Call the provided zend_function with the given params. * If retval_ptr is NULL, the return value is discarded. @@ -602,17 +602,17 @@ static zend_always_inline void zend_call_known_instance_method_with_1_params( ZEND_API void zend_call_known_instance_method_with_2_params( zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2); -ZEND_API ZEND_RESULT_CODE zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API zend_result zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API ZEND_RESULT_CODE zend_delete_global_variable(zend_string *name); +ZEND_API zend_result zend_delete_global_variable(zend_string *name); ZEND_API zend_array *zend_rebuild_symbol_table(void); ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data); ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data); -ZEND_API ZEND_RESULT_CODE zend_set_local_var(zend_string *name, zval *value, bool force); -ZEND_API ZEND_RESULT_CODE zend_set_local_var_str(const char *name, size_t len, zval *value, bool force); +ZEND_API zend_result zend_set_local_var(zend_string *name, zval *value, bool force); +ZEND_API zend_result zend_set_local_var_str(const char *name, size_t len, zval *value, bool force); -static zend_always_inline ZEND_RESULT_CODE zend_forbid_dynamic_call(const char *func_name) +static zend_always_inline zend_result zend_forbid_dynamic_call(const char *func_name) { zend_execute_data *ex = EG(current_execute_data); ZEND_ASSERT(ex != NULL && ex->func != NULL); @@ -631,7 +631,7 @@ ZEND_API zend_bool zend_is_iterable(zval *iterable); ZEND_API zend_bool zend_is_countable(zval *countable); -ZEND_API ZEND_RESULT_CODE zend_get_default_from_internal_arg_info( +ZEND_API zend_result zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info); END_EXTERN_C() @@ -779,21 +779,21 @@ END_EXTERN_C() /* May modify arg in-place. Will free arg in failure case (and take ownership in success case). * Prefer using the ZEND_TRY_ASSIGN_* macros over these APIs. */ -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref(zend_reference *ref, zval *zv); - -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_null(zend_reference *ref); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_double(zend_reference *ref, double dval); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_empty_string(zend_reference *ref); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); -ZEND_API ZEND_RESULT_CODE zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API zend_result zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API zend_result zend_try_assign_typed_ref(zend_reference *ref, zval *zv); + +ZEND_API zend_result zend_try_assign_typed_ref_null(zend_reference *ref); +ZEND_API zend_result zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); +ZEND_API zend_result zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); +ZEND_API zend_result zend_try_assign_typed_ref_double(zend_reference *ref, double dval); +ZEND_API zend_result zend_try_assign_typed_ref_empty_string(zend_reference *ref); +ZEND_API zend_result zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); +ZEND_API zend_result zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); +ZEND_API zend_result zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); +ZEND_API zend_result zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); +ZEND_API zend_result zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); +ZEND_API zend_result zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); +ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); #define _ZEND_TRY_ASSIGN_NULL(zv, is_ref) do { \ zval *_zv = zv; \ diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index c417189dd30fd..f746b408a1f84 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -438,7 +438,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op) return (zend_ast *) list; } -static ZEND_RESULT_CODE zend_ast_add_array_element(zval *result, zval *offset, zval *expr) +static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *expr) { switch (Z_TYPE_P(offset)) { case IS_UNDEF: @@ -478,7 +478,7 @@ static ZEND_RESULT_CODE zend_ast_add_array_element(zval *result, zval *offset, z return SUCCESS; } -static ZEND_RESULT_CODE zend_ast_add_unpacked_element(zval *result, zval *expr) { +static zend_result zend_ast_add_unpacked_element(zval *result, zval *expr) { if (EXPECTED(Z_TYPE_P(expr) == IS_ARRAY)) { HashTable *ht = Z_ARRVAL_P(expr); zval *val; @@ -505,10 +505,10 @@ static ZEND_RESULT_CODE zend_ast_add_unpacked_element(zval *result, zval *expr) return FAILURE; } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) +ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) { zval op1, op2; - ZEND_RESULT_CODE ret = SUCCESS; + zend_result ret = SUCCESS; switch (ast->kind) { case ZEND_AST_BINARY_OP: diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index 36f1ab665939f..2d72759c392a4 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -290,7 +290,7 @@ ZEND_API zend_ast *zend_ast_create_decl( zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2, zend_ast *child3, zend_ast *child4 ); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); +ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); ZEND_API zend_string *zend_ast_export(const char *prefix, zend_ast *ast, const char *suffix); ZEND_API zend_ast_ref * ZEND_FASTCALL zend_ast_copy(zend_ast *ast); diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index 6ff35cbe4cd3c..af5baa6ce07d1 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -116,7 +116,7 @@ ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, return get_attribute_str(attributes, str, len, offset + 1); } -ZEND_API ZEND_RESULT_CODE zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) +ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) { if (i >= attr->argc) { return FAILURE; diff --git a/Zend/zend_attributes.h b/Zend/zend_attributes.h index 02b0311a3465b..6a60b06665a8f 100644 --- a/Zend/zend_attributes.h +++ b/Zend/zend_attributes.h @@ -63,7 +63,7 @@ ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const cha ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset); ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset); -ZEND_API ZEND_RESULT_CODE zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); +ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets); ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index ba10e62522259..c3a2a1b63f331 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -57,7 +57,7 @@ zend_module_entry zend_builtin_module = { /* {{{ */ }; /* }}} */ -ZEND_RESULT_CODE zend_startup_builtin_functions(void) /* {{{ */ +zend_result zend_startup_builtin_functions(void) /* {{{ */ { zend_builtin_module.module_number = 0; zend_builtin_module.type = MODULE_PERSISTENT; diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index 4fda0e0abfa14..a49dab1b46838 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -20,7 +20,7 @@ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H -ZEND_RESULT_CODE zend_startup_builtin_functions(void); +zend_result zend_startup_builtin_functions(void); BEGIN_EXTERN_C() ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index b2d6456cf7727..630857f26c1df 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -273,7 +273,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ { } /* }}} */ -static ZEND_RESULT_CODE zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { +static zend_result zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { zend_fcall_info_cache fcc; zend_function *mptr; zval instance; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 3396c933e6658..b54b435ae9f62 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1076,7 +1076,7 @@ static zend_never_inline ZEND_COLD ZEND_NORETURN void do_bind_function_error(zen } } -ZEND_API ZEND_RESULT_CODE do_bind_function(zval *lcname) /* {{{ */ +ZEND_API zend_result do_bind_function(zval *lcname) /* {{{ */ { zend_function *function; zval *rtd_key, *zv; @@ -1097,7 +1097,7 @@ ZEND_API ZEND_RESULT_CODE do_bind_function(zval *lcname) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ +ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ { zend_class_entry *ce; zval *rtd_key, *zv; @@ -1376,7 +1376,7 @@ static zend_always_inline size_t zend_strnlen(const char* s, size_t maxlen) /* { } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ +ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ { size_t class_name_len; size_t anonclass_src_len; @@ -1749,10 +1749,10 @@ zend_bool zend_is_auto_global(zend_string *name) /* {{{ */ } /* }}} */ -ZEND_RESULT_CODE zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ +zend_result zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ { zend_auto_global auto_global; - ZEND_RESULT_CODE retval; + zend_result retval; auto_global.name = name; auto_global.auto_global_callback = auto_global_callback; @@ -2597,7 +2597,7 @@ static void zend_compile_class_ref(znode *result, zend_ast *name_ast, uint32_t f } /* }}} */ -static ZEND_RESULT_CODE zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ +static zend_result zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ { zend_ast *name_ast = ast->child[0]; if (name_ast->kind == ZEND_AST_ZVAL) { @@ -3637,7 +3637,7 @@ static inline zend_bool zend_args_contain_unpack_or_named(zend_ast_list *args) / } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -3657,7 +3657,7 @@ ZEND_RESULT_CODE zend_compile_func_strlen(znode *result, zend_ast_list *args) /* } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +zend_result zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3677,7 +3677,7 @@ ZEND_RESULT_CODE zend_compile_func_typecheck(znode *result, zend_ast_list *args, } /* }}} */ -static ZEND_RESULT_CODE zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ +static zend_result zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3692,7 +3692,7 @@ static ZEND_RESULT_CODE zend_compile_func_is_scalar(znode *result, zend_ast_list return SUCCESS; } -ZEND_RESULT_CODE zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +zend_result zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3712,7 +3712,7 @@ ZEND_RESULT_CODE zend_compile_func_cast(znode *result, zend_ast_list *args, uint } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ { zend_string *name; zend_op *opline; @@ -3744,7 +3744,7 @@ ZEND_RESULT_CODE zend_compile_func_defined(znode *result, zend_ast_list *args) / } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && @@ -3762,7 +3762,7 @@ ZEND_RESULT_CODE zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{ } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && args->child[0]->kind == ZEND_AST_ZVAL && @@ -3784,7 +3784,7 @@ static zend_bool fbc_is_finalized(zend_function *fbc) { return !ZEND_USER_CODE(fbc->type) || (fbc->common.fn_flags & ZEND_ACC_DONE_PASS_TWO); } -static ZEND_RESULT_CODE zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ +static zend_result zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ { zend_string *name, *lcname; zend_function *fbc; @@ -3837,7 +3837,7 @@ static void zend_compile_init_user_func(zend_ast *name_ast, uint32_t num_args, z /* }}} */ /* cufa = call_user_func_array */ -ZEND_RESULT_CODE zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; @@ -3887,7 +3887,7 @@ ZEND_RESULT_CODE zend_compile_func_cufa(znode *result, zend_ast_list *args, zend /* }}} */ /* cuf = call_user_func */ -ZEND_RESULT_CODE zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { uint32_t i; @@ -3958,7 +3958,7 @@ static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string } /* }}} */ -static ZEND_RESULT_CODE zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ +static zend_result zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ { zend_bool strict = 0; znode array, needly; @@ -4043,7 +4043,7 @@ static ZEND_RESULT_CODE zend_compile_func_in_array(znode *result, zend_ast_list } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; zend_op *opline; @@ -4060,7 +4060,7 @@ ZEND_RESULT_CODE zend_compile_func_count(znode *result, zend_ast_list *args, zen } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 0) { zend_emit_op_tmp(result, ZEND_GET_CLASS, NULL, NULL); @@ -4078,7 +4078,7 @@ ZEND_RESULT_CODE zend_compile_func_get_class(znode *result, zend_ast_list *args) } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children != 0) { return FAILURE; @@ -4089,7 +4089,7 @@ ZEND_RESULT_CODE zend_compile_func_get_called_class(znode *result, zend_ast_list } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -4103,7 +4103,7 @@ ZEND_RESULT_CODE zend_compile_func_gettype(znode *result, zend_ast_list *args) / } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_NUM_ARGS, NULL, NULL); @@ -4114,7 +4114,7 @@ ZEND_RESULT_CODE zend_compile_func_num_args(znode *result, zend_ast_list *args) } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_GET_ARGS, NULL, NULL); @@ -4125,7 +4125,7 @@ ZEND_RESULT_CODE zend_compile_func_get_args(znode *result, zend_ast_list *args) } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ { znode subject, needle; @@ -4141,7 +4141,7 @@ ZEND_RESULT_CODE zend_compile_func_array_key_exists(znode *result, zend_ast_list } /* }}} */ -ZEND_RESULT_CODE zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 2 @@ -4174,7 +4174,7 @@ ZEND_RESULT_CODE zend_compile_func_array_slice(znode *result, zend_ast_list *arg } /* }}} */ -ZEND_RESULT_CODE zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ +zend_result zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ { if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) { return FAILURE; @@ -5859,7 +5859,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ } /* }}} */ -static ZEND_RESULT_CODE zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ +static zend_result zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ { uint32_t i = 0; zend_ast_list *file_ast = zend_ast_get_list(CG(ast)); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 6dee886022832..e50f620ed4078 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -751,8 +751,8 @@ const char *zend_get_zendtext(void); int zend_get_zendleng(void); #endif -typedef ZEND_RESULT_CODE (ZEND_FASTCALL *unary_op_type)(zval *, zval *); -typedef ZEND_RESULT_CODE (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); +typedef zend_result (ZEND_FASTCALL *unary_op_type)(zval *, zval *); +typedef zend_result (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); ZEND_API unary_op_type get_unary_op(int opcode); ZEND_API binary_op_type get_binary_op(int opcode); @@ -770,8 +770,8 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast); /* parser-driven code generators */ void zend_do_free(znode *op1); -ZEND_API ZEND_RESULT_CODE do_bind_function(zval *lcname); -ZEND_API ZEND_RESULT_CODE do_bind_class(zval *lcname, zend_string *lc_parent_name); +ZEND_API zend_result do_bind_function(zval *lcname); +ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name); ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array); ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline); @@ -826,7 +826,7 @@ void zend_class_add_ref(zval *zv); ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal); #define zend_unmangle_property_name(mangled_property, class_name, prop_name) \ zend_unmangle_property_name_ex(mangled_property, class_name, prop_name, NULL) -ZEND_API ZEND_RESULT_CODE zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); +ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); static zend_always_inline const char *zend_get_unmangled_property_name(const zend_string *mangled_prop) { const char *class_name, *prop_name; @@ -857,7 +857,7 @@ typedef struct _zend_auto_global { zend_bool armed; } zend_auto_global; -ZEND_API ZEND_RESULT_CODE zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); +ZEND_API zend_result zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); ZEND_API void zend_activate_auto_globals(void); ZEND_API zend_bool zend_is_auto_global(zend_string *name); ZEND_API zend_bool zend_is_auto_global_str(const char *name, size_t len); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 2858fc15000d0..3ad32446ff56c 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -393,7 +393,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, } if (ret_constant && Z_TYPE_P(ret_constant) == IS_CONSTANT_AST) { - ZEND_RESULT_CODE ret; + zend_result ret; if (IS_CONSTANT_VISITED(ret_constant)) { zend_throw_error(NULL, "Cannot declare self-referencing constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); @@ -477,11 +477,11 @@ static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_consta return ret; } -ZEND_API ZEND_RESULT_CODE zend_register_constant(zend_constant *c) +ZEND_API zend_result zend_register_constant(zend_constant *c) { zend_string *lowercase_name = NULL; zend_string *name; - ZEND_RESULT_CODE ret = SUCCESS; + zend_result ret = SUCCESS; zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; #if 0 diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index 6090623c07820..0a3c5a737760c 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -82,7 +82,7 @@ ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zen ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number); ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number); ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number); -ZEND_API ZEND_RESULT_CODE zend_register_constant(zend_constant *c); +ZEND_API zend_result zend_register_constant(zend_constant *c); #ifdef ZTS void zend_copy_constants(HashTable *target, HashTable *sourc); #endif diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index ee3a63a50ddeb..709dfa14c727b 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -908,11 +908,11 @@ static void zend_error_va(int type, const char *file, uint32_t lineno, const cha /* }}} */ /* This function doesn't return if it uses E_ERROR */ -ZEND_API ZEND_COLD ZEND_RESULT_CODE zend_exception_error(zend_object *ex, int severity) /* {{{ */ +ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity) /* {{{ */ { zval exception, rv; zend_class_entry *ce_exception; - ZEND_RESULT_CODE result = FAILURE; + zend_result result = FAILURE; ZVAL_OBJ(&exception, ex); ce_exception = ex->ce; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 78eff15a40e12..9d0c18a6dada5 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -67,7 +67,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, extern ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); /* show an exception using zend_error(severity,...), severity should be E_ERROR */ -ZEND_API ZEND_COLD ZEND_RESULT_CODE zend_exception_error(zend_object *exception, int severity); +ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *exception, int severity); ZEND_API ZEND_COLD void zend_throw_unwind_exit(void); ZEND_API zend_bool zend_is_unwind_exit(zend_object *ex); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 8f69f0a0f08a9..c0e6adf79b840 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1899,7 +1899,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_index(const zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset)); } -ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -1917,7 +1917,7 @@ ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_offset_write(Ha return SUCCESS; } -ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -2889,7 +2889,7 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co OPLINE_CC EXECUTE_DATA_CC); } -static zend_never_inline ZEND_RESULT_CODE zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { +static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { zend_string *name; zend_class_entry *ce; zend_property_info *property_info; @@ -2967,7 +2967,7 @@ static zend_never_inline ZEND_RESULT_CODE zend_fetch_static_property_address_ex( } -static zend_always_inline ZEND_RESULT_CODE zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { +static zend_always_inline zend_result zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { zend_property_info *property_info; if (opline->op1_type == IS_CONST && (opline->op2_type == IS_CONST || (opline->op2_type == IS_UNUSED && (opline->op2.num == ZEND_FETCH_CLASS_SELF || opline->op2.num == ZEND_FETCH_CLASS_PARENT))) && EXPECTED(CACHED_PTR(cache_slot) != NULL)) { @@ -2983,7 +2983,7 @@ static zend_always_inline ZEND_RESULT_CODE zend_fetch_static_property_address(zv return FAILURE; } } else { - ZEND_RESULT_CODE success; + zend_result success; success = zend_fetch_static_property_address_ex(retval, &property_info, cache_slot, fetch_type OPLINE_CC EXECUTE_DATA_CC); if (UNEXPECTED(success != SUCCESS)) { return FAILURE; @@ -4282,7 +4282,7 @@ static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *ar } /* }}} */ -static zend_always_inline ZEND_RESULT_CODE _zend_quick_get_constant( +static zend_always_inline zend_result _zend_quick_get_constant( const zval *key, uint32_t flags, bool check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { zval *zv; @@ -4327,7 +4327,7 @@ static zend_never_inline void ZEND_FASTCALL zend_quick_get_constant( _zend_quick_get_constant(key, flags, 0 OPLINE_CC EXECUTE_DATA_CC); } /* }}} */ -static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL zend_quick_check_constant( +static zend_never_inline zend_result ZEND_FASTCALL zend_quick_check_constant( const zval *key OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { return _zend_quick_get_constant(key, 0, 1 OPLINE_CC EXECUTE_DATA_CC); @@ -4450,7 +4450,7 @@ static void end_fake_frame(zend_execute_data *call) { } } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { +ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { zend_function *fbc = call->func; if (fbc->type == ZEND_USER_FUNCTION) { uint32_t num_args = ZEND_CALL_NUM_ARGS(call); @@ -4478,7 +4478,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_handle_undef_args(zend_execute_data zval tmp; ZVAL_COPY(&tmp, default_value); start_fake_frame(call, opline); - ZEND_RESULT_CODE ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); + zend_result ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); end_fake_frame(call); if (UNEXPECTED(ret == FAILURE)) { zval_ptr_dtor_nogc(&tmp); @@ -4533,7 +4533,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_handle_undef_args(zend_execute_data if (Z_TYPE(default_value) == IS_CONSTANT_AST) { start_fake_frame(call, NULL); - ZEND_RESULT_CODE ret = zval_update_constant_ex(&default_value, fbc->common.scope); + zend_result ret = zval_update_constant_ex(&default_value, fbc->common.scope); end_fake_frame(call); if (ret == FAILURE) { return FAILURE; @@ -4750,7 +4750,7 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint #include "zend_vm_execute.h" -ZEND_API ZEND_RESULT_CODE zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) +ZEND_API zend_result zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) { if (opcode != ZEND_USER_OPCODE) { if (handler == NULL) { diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 9d94992586f3a..fb1a39898ca70 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -47,10 +47,10 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name); ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags); ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex); ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex); -ZEND_API ZEND_RESULT_CODE zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); -ZEND_API ZEND_RESULT_CODE zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); -ZEND_API ZEND_RESULT_CODE zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions); -ZEND_API ZEND_RESULT_CODE zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions); +ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); +ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); +ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions); +ZEND_API zend_result zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions); /* export zend_pass_function to allow comparisons against it */ extern ZEND_API const zend_internal_function zend_pass_function; @@ -64,8 +64,8 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv); ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv); -ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); -ZEND_API ZEND_COLD ZEND_RESULT_CODE ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg); ZEND_API ZEND_COLD void zend_verify_arg_error( @@ -155,8 +155,8 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval return variable_ptr; } -ZEND_API ZEND_RESULT_CODE zval_update_constant(zval *pp); -ZEND_API ZEND_RESULT_CODE zval_update_constant_ex(zval *pp, zend_class_entry *scope); +ZEND_API zend_result zval_update_constant(zval *pp); +ZEND_API zend_result zval_update_constant_ex(zval *pp, zend_class_entry *scope); /* dedicated Zend executor functions - do not use! */ struct _zend_vm_stack { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 9059ce61841f2..77964e546b0f0 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -585,7 +585,7 @@ ZEND_API zend_bool zend_is_executing(void) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ +ZEND_API zend_result zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ { if (Z_TYPE_P(p) == IS_CONSTANT_AST) { zend_ast *ast = Z_ASTVAL_P(p); @@ -613,13 +613,13 @@ ZEND_API ZEND_RESULT_CODE zval_update_constant_ex(zval *p, zend_class_entry *sco } /* }}} */ -ZEND_API ZEND_RESULT_CODE zval_update_constant(zval *pp) /* {{{ */ +ZEND_API zend_result zval_update_constant(zval *pp) /* {{{ */ { return zval_update_constant_ex(pp, EG(current_execute_data) ? zend_get_executed_scope() : CG(active_class_entry)); } /* }}} */ -ZEND_RESULT_CODE _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ +zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ { zend_fcall_info fci; @@ -635,7 +635,7 @@ ZEND_RESULT_CODE _call_user_function_impl(zval *object, zval *function_name, zva } /* }}} */ -ZEND_RESULT_CODE zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ +zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ { uint32_t i; zend_execute_data *call, dummy_execute_data; @@ -956,7 +956,7 @@ ZEND_API void zend_call_known_function( fcic.object = object; fcic.called_scope = called_scope; - ZEND_RESULT_CODE result = zend_call_function(&fci, &fcic); + zend_result result = zend_call_function(&fci, &fcic); if (UNEXPECTED(result == FAILURE)) { if (!EG(exception)) { zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", @@ -1134,12 +1134,12 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ { zval pv; zend_op_array *new_op_array; uint32_t original_compiler_options; - ZEND_RESULT_CODE retval; + zend_result retval; if (retval_ptr) { ZVAL_NEW_STR(&pv, zend_string_alloc(str_len + sizeof("return ;")-1, 0)); @@ -1198,15 +1198,15 @@ ZEND_API ZEND_RESULT_CODE zend_eval_stringl(const char *str, size_t str_len, zva } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ { return zend_eval_stringl(str, strlen(str), retval_ptr, string_name); } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ +ZEND_API zend_result zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { - ZEND_RESULT_CODE result; + zend_result result; result = zend_eval_stringl(str, str_len, retval_ptr, string_name); if (handle_exceptions && EG(exception)) { @@ -1216,7 +1216,7 @@ ZEND_API ZEND_RESULT_CODE zend_eval_stringl_ex(const char *str, size_t str_len, } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ +ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions); } @@ -1525,7 +1525,7 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_delete_global_variable(zend_string *name) /* {{{ */ +ZEND_API zend_result zend_delete_global_variable(zend_string *name) /* {{{ */ { return zend_hash_del_ind(&EG(symbol_table), name); } @@ -1638,7 +1638,7 @@ ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ * } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_set_local_var(zend_string *name, zval *value, bool force) /* {{{ */ +ZEND_API zend_result zend_set_local_var(zend_string *name, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); @@ -1681,7 +1681,7 @@ ZEND_API ZEND_RESULT_CODE zend_set_local_var(zend_string *name, zval *value, boo } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_set_local_var_str(const char *name, size_t len, zval *value, bool force) /* {{{ */ +ZEND_API zend_result zend_set_local_var_str(const char *name, size_t len, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index a547ede770071..c44a2f3093752 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -24,7 +24,7 @@ ZEND_API uint32_t zend_extension_flags = 0; ZEND_API int zend_op_array_extension_handles = 0; static int last_resource_number; -ZEND_RESULT_CODE zend_load_extension(const char *path) +zend_result zend_load_extension(const char *path) { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; @@ -51,7 +51,7 @@ ZEND_RESULT_CODE zend_load_extension(const char *path) #endif } -ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path) +zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path) { #if ZEND_EXTENSIONS_SUPPORT zend_extension *new_extension; diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 02fd3bb6dc51a..a26a6f9fc7e25 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -145,8 +145,8 @@ void zend_startup_extensions(void); void zend_shutdown_extensions(void); BEGIN_EXTERN_C() -ZEND_API ZEND_RESULT_CODE zend_load_extension(const char *path); -ZEND_API ZEND_RESULT_CODE zend_load_extension_handle(DL_HANDLE handle, const char *path); +ZEND_API zend_result zend_load_extension(const char *path); +ZEND_API zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path); ZEND_API void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); ZEND_API zend_extension *zend_get_extension(const char *extension_name); ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 590508dd4f474..4f35b727aece3 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -629,7 +629,7 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator return root; } -static ZEND_RESULT_CODE zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ +static zend_result zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ { zval *value; if (Z_TYPE(generator->values) == IS_ARRAY) { diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 5779a079232f1..abda03edf631e 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1360,7 +1360,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p) _zend_hash_del_el(ht, HT_IDX_TO_HASH(p - ht->arData), p); } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) +ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1390,7 +1390,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string return FAILURE; } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) +ZEND_API zend_result ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1438,7 +1438,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_st return FAILURE; } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1482,7 +1482,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, con return FAILURE; } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1512,7 +1512,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const c return FAILURE; } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) +ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) { uint32_t nIndex; uint32_t idx; @@ -2325,7 +2325,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Has } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) { uint32_t idx; @@ -2350,7 +2350,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, } } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) { uint32_t idx = *pos; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index bbd5205db3a9d..fb11c4a9e321e 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -162,11 +162,11 @@ ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t /* Deletes */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); +ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); +ZEND_API zend_result ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); +ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p); /* Data retrieval */ @@ -227,11 +227,11 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *h #define zend_hash_has_more_elements_ex(ht, pos) \ (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); @@ -460,7 +460,7 @@ static zend_always_inline zval *zend_symtable_update_ind(HashTable *ht, zend_str } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_del(HashTable *ht, zend_string *key) +static zend_always_inline zend_result zend_symtable_del(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -472,7 +472,7 @@ static zend_always_inline ZEND_RESULT_CODE zend_symtable_del(HashTable *ht, zend } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_del_ind(HashTable *ht, zend_string *key) +static zend_always_inline zend_result zend_symtable_del_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -556,7 +556,7 @@ static zend_always_inline zval *zend_symtable_str_update_ind(HashTable *ht, cons } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_del(HashTable *ht, const char *str, size_t len) +static zend_always_inline zend_result zend_symtable_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -568,7 +568,7 @@ static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_del(HashTable *ht, } -static zend_always_inline ZEND_RESULT_CODE zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) +static zend_always_inline zend_result zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong idx; diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 6f8e5e51be57e..c4f819d508c1e 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -39,7 +39,7 @@ typedef struct _zend_syntax_highlighter_ini { BEGIN_EXTERN_C() ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini); ZEND_API void zend_strip(void); -ZEND_API ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); +ZEND_API zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); ZEND_API void highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); ZEND_API void zend_html_putc(char c); ZEND_API void zend_html_puts(const char *s, size_t len); diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 3054bd162135f..4d2e2d540074c 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -2390,7 +2390,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) { } } -ZEND_API ZEND_RESULT_CODE zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ +ZEND_API zend_result zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ { /* Load parent/interface dependencies first, so we can still gracefully abort linking * with an exception and remove the class from the class table. This is only possible diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index 067519c5f2347..e49ec49b6f958 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -30,7 +30,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par #define zend_do_inheritance(ce, parent_ce) \ zend_do_inheritance_ex(ce, parent_ce, 0) -ZEND_API ZEND_RESULT_CODE zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); +ZEND_API zend_result zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); void zend_verify_abstract_class(zend_class_entry *ce); void zend_build_properties_info_table(zend_class_entry *ce); diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 0f4970a28909d..75c7faf4c014e 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -41,9 +41,9 @@ static int zend_remove_ini_entries(zval *el, void *arg) /* {{{ */ } /* }}} */ -static ZEND_RESULT_CODE zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ +static zend_result zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ { - ZEND_RESULT_CODE result = FAILURE; + zend_result result = FAILURE; if (ini_entry->modified) { if (ini_entry->on_modify) { @@ -194,7 +194,7 @@ ZEND_API void zend_ini_sort_entries(void) /* {{{ */ /* * Registration / unregistration */ -ZEND_API ZEND_RESULT_CODE zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ +ZEND_API zend_result zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ { zend_ini_entry *p; zval *default_value; @@ -275,16 +275,16 @@ ZEND_API void zend_ini_refresh_caches(int stage) /* {{{ */ /* }}} */ #endif -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ { return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0); } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ { - ZEND_RESULT_CODE ret; + zend_result ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -294,9 +294,9 @@ ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars(zend_string *name, const ch } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ { - ZEND_RESULT_CODE ret; + zend_result ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -306,7 +306,7 @@ ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars_ex(zend_string *name, const } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change) /* {{{ */ { zend_ini_entry *ini_entry; zend_string *duplicate; @@ -358,7 +358,7 @@ ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_ex(zend_string *name, zend_string } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ +ZEND_API zend_result zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ { zend_ini_entry *ini_entry; @@ -379,7 +379,7 @@ ZEND_API ZEND_RESULT_CODE zend_restore_ini_entry(zend_string *name, int stage) / } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ +ZEND_API zend_result zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 99378298b2671..d227f3779d990 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -71,14 +71,14 @@ ZEND_API void zend_copy_ini_directives(void); ZEND_API void zend_ini_sort_entries(void); -ZEND_API ZEND_RESULT_CODE zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); +ZEND_API zend_result zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); ZEND_API void zend_unregister_ini_entries(int module_number); ZEND_API void zend_ini_refresh_caches(int stage); -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change); -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); -ZEND_API ZEND_RESULT_CODE zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); -ZEND_API ZEND_RESULT_CODE zend_restore_ini_entry(zend_string *name, int stage); +ZEND_API zend_result zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); +ZEND_API zend_result zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change); +ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); +ZEND_API zend_result zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); +ZEND_API zend_result zend_restore_ini_entry(zend_string *name, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig); @@ -88,7 +88,7 @@ ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig ZEND_API zend_string *zend_ini_get_value(zend_string *name); ZEND_API zend_bool zend_ini_parse_bool(zend_string *str); -ZEND_API ZEND_RESULT_CODE zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); +ZEND_API zend_result zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index c65485d6f1933..f9170d9ecc024 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -212,7 +212,7 @@ static ZEND_COLD void ini_error(const char *msg) /* }}} */ /* {{{ zend_parse_ini_file() */ -ZEND_API ZEND_RESULT_CODE zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API zend_result zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; @@ -240,7 +240,7 @@ ZEND_API ZEND_RESULT_CODE zend_parse_ini_file(zend_file_handle *fh, zend_bool un /* }}} */ /* {{{ zend_parse_ini_string() */ -ZEND_API ZEND_RESULT_CODE zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API zend_result zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index 6d5d2f5062b01..f3d7f1a82b271 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -28,8 +28,8 @@ BEGIN_EXTERN_C() ZEND_COLD int zend_ini_scanner_get_lineno(void); ZEND_COLD char *zend_ini_scanner_get_filename(void); -ZEND_RESULT_CODE zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); -ZEND_RESULT_CODE zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); +zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); +zend_result zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); int ini_lex(zval *ini_lval); void shutdown_ini_scanner(void); END_EXTERN_C() diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 8324526419f12..1d689f3748a5d 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -151,7 +151,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; return type; \ } -static inline ZEND_RESULT_CODE convert_to_number(zval *retval, const char *str, const int str_len) +static inline zend_result convert_to_number(zval *retval, const char *str, const int str_len) { zend_uchar type; int overflow; @@ -218,7 +218,7 @@ static void yy_scan_buffer(char *str, unsigned int len) #define ini_filename SCNG(filename) /* {{{ init_ini_scanner() */ -static ZEND_RESULT_CODE init_ini_scanner(int scanner_mode, zend_file_handle *fh) +static zend_result init_ini_scanner(int scanner_mode, zend_file_handle *fh) { /* Sanity check */ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) { @@ -268,7 +268,7 @@ ZEND_COLD char *zend_ini_scanner_get_filename(void) /* }}} */ /* {{{ zend_ini_open_file_for_scanning() */ -ZEND_RESULT_CODE zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) +zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) { char *buf; size_t size; @@ -289,7 +289,7 @@ ZEND_RESULT_CODE zend_ini_open_file_for_scanning(zend_file_handle *fh, int scann /* }}} */ /* {{{ zend_ini_prepare_string_for_scanning() */ -ZEND_RESULT_CODE zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) +zend_result zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) { int len = (int)strlen(str); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 3d44b4769b29b..1278f08209d67 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -358,7 +358,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b { zend_class_entry * ce = Z_OBJCE_P(object); zval retval; - ZEND_RESULT_CODE result; + zend_result result; zend_call_method_with_0_params( Z_OBJ_P(object), Z_OBJCE_P(object), NULL, "serialize", &retval); @@ -460,7 +460,7 @@ static zend_object *zend_internal_iterator_create(zend_class_entry *ce) { return &intern->std; } -ZEND_API ZEND_RESULT_CODE zend_create_internal_iterator_zval(zval *return_value, zval *obj) { +ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj) { zend_class_entry *scope = EG(current_execute_data)->func->common.scope; ZEND_ASSERT(scope->get_iterator != zend_user_it_get_new_iterator); zend_object_iterator *iter = scope->get_iterator(Z_OBJCE_P(obj), obj, /* by_ref */ 0); @@ -494,7 +494,7 @@ static zend_internal_iterator *zend_internal_iterator_fetch(zval *This) { } /* Many iterators will not behave correctly if rewind() is not called, make sure it happens. */ -static ZEND_RESULT_CODE zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { +static zend_result zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { if (!intern->rewind_called) { zend_object_iterator *iter = intern->iter; intern->rewind_called = 1; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 2f09402c90e5c..ecdc9b0e1b278 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -61,7 +61,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z zend_class_implements(zend_ce_ ## class_name, 1, zend_ce_ ## interface_name) ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter); -ZEND_API ZEND_RESULT_CODE zend_user_it_valid(zend_object_iterator *_iter); +ZEND_API zend_result zend_user_it_valid(zend_object_iterator *_iter); ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key); ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter); ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter); @@ -78,7 +78,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); -ZEND_API ZEND_RESULT_CODE zend_create_internal_iterator_zval(zval *return_value, zval *obj); +ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index 7af718c5a108b..f08dbb4ea91d8 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -77,8 +77,8 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state); ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state); ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename); ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding); -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_filter(const zend_encoding *onetime_encoding); -ZEND_API ZEND_RESULT_CODE zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); +ZEND_API zend_result zend_multibyte_set_filter(const zend_encoding *onetime_encoding); +ZEND_API zend_result zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 7ebfe30b93ed4..ee88282fd5176 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -306,7 +306,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle) } } -ZEND_API ZEND_RESULT_CODE zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) +ZEND_API zend_result zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) { char *ident = (char *) SCNG(yy_start) + ident_ref.offset; size_t length = ident_ref.len; @@ -486,7 +486,7 @@ static const zend_encoding* zend_multibyte_find_script_encoding(void) return CG(script_encoding_list)[0]; } -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_filter(const zend_encoding *onetime_encoding) +ZEND_API zend_result zend_multibyte_set_filter(const zend_encoding *onetime_encoding) { const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(); const zend_encoding *script_encoding = onetime_encoding ? onetime_encoding: zend_multibyte_find_script_encoding(); @@ -527,7 +527,7 @@ ZEND_API ZEND_RESULT_CODE zend_multibyte_set_filter(const zend_encoding *onetime return SUCCESS; } -ZEND_API ZEND_RESULT_CODE open_file_for_scanning(zend_file_handle *file_handle) +ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle) { char *buf; size_t size; @@ -833,7 +833,7 @@ zend_op_array *compile_string(zval *source_string, const char *filename) BEGIN_EXTERN_C() -ZEND_RESULT_CODE highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) +zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) { zend_lex_state original_lex_state; zend_file_handle file_handle; @@ -927,7 +927,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter ZVAL_STRINGL(zendlval, yytext, yyleng); \ } -static ZEND_RESULT_CODE zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) +static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) { register char *s, *t; char *end; @@ -1280,7 +1280,7 @@ static void enter_nesting(char opening) zend_stack_push(&SCNG(nest_location_stack), &nest_loc); } -static ZEND_RESULT_CODE exit_nesting(char closing) +static zend_result exit_nesting(char closing) { if (zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_throw_exception_ex(zend_ce_parse_error, 0, "Unmatched '%c'", closing); @@ -1301,7 +1301,7 @@ static ZEND_RESULT_CODE exit_nesting(char closing) return SUCCESS; } -static ZEND_RESULT_CODE check_nesting_at_end() +static zend_result check_nesting_at_end() { if (!zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_nest_location *nest_loc = zend_stack_top(&SCNG(nest_location_stack)); diff --git a/Zend/zend_list.c b/Zend/zend_list.c index ee0e7dcc56b39..45ff950b6bfec 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -42,7 +42,7 @@ ZEND_API zval* ZEND_FASTCALL zend_list_insert(void *ptr, int type) return zend_hash_index_add_new(&EG(regular_list), index, &zv); } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL zend_list_delete(zend_resource *res) +ZEND_API zend_result ZEND_FASTCALL zend_list_delete(zend_resource *res) { if (GC_DELREF(res) <= 0) { return zend_hash_index_del(&EG(regular_list), res->handle); diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 05f7085190c8f..cb64324d38bc7 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -77,10 +77,10 @@ struct _zend_module_entry { const struct _zend_module_dep *deps; const char *name; const struct _zend_function_entry *functions; - ZEND_RESULT_CODE (*module_startup_func)(INIT_FUNC_ARGS); - ZEND_RESULT_CODE (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - ZEND_RESULT_CODE (*request_startup_func)(INIT_FUNC_ARGS); - ZEND_RESULT_CODE (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); + zend_result (*module_startup_func)(INIT_FUNC_ARGS); + zend_result (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); + zend_result (*request_startup_func)(INIT_FUNC_ARGS); + zend_result (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); const char *version; size_t globals_size; diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index cbf6213b1790c..f8dab668751a1 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -48,7 +48,7 @@ static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, co return (size_t)-1; } -static ZEND_RESULT_CODE dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) +static zend_result dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { *return_list = pemalloc(0, persistent); *return_size = 0; @@ -60,7 +60,7 @@ static const zend_encoding *dummy_internal_encoding_getter(void) return NULL; } -static ZEND_RESULT_CODE dummy_internal_encoding_setter(const zend_encoding *encoding) +static zend_result dummy_internal_encoding_setter(const zend_encoding *encoding) { return FAILURE; } @@ -84,7 +84,7 @@ ZEND_API const zend_encoding *zend_multibyte_encoding_utf16be = (const zend_enco ZEND_API const zend_encoding *zend_multibyte_encoding_utf16le = (const zend_encoding*)"UTF-32LE"; ZEND_API const zend_encoding *zend_multibyte_encoding_utf8 = (const zend_encoding*)"UTF-8"; -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_functions(const zend_multibyte_functions *functions) +ZEND_API zend_result zend_multibyte_set_functions(const zend_multibyte_functions *functions) { zend_multibyte_encoding_utf32be = functions->encoding_fetcher("UTF-32BE"); if (!zend_multibyte_encoding_utf32be) { @@ -155,7 +155,7 @@ ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to return multibyte_functions.encoding_converter(to, to_length, from, from_length, encoding_to, encoding_from); } -ZEND_API ZEND_RESULT_CODE zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) +ZEND_API zend_result zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return multibyte_functions.encoding_list_parser(encoding_list, encoding_list_len, return_list, return_size, persistent); } @@ -180,12 +180,12 @@ ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_l return SUCCESS; } -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_internal_encoding(const zend_encoding *encoding) +ZEND_API zend_result zend_multibyte_set_internal_encoding(const zend_encoding *encoding) { return multibyte_functions.internal_encoding_setter(encoding); } -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) +ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) { const zend_encoding **list = 0; size_t size = 0; diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 2281fb5abfb28..5466840cd900a 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -29,9 +29,9 @@ typedef const char* (*zend_encoding_name_getter)(const zend_encoding *encoding); typedef bool (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding); typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size); typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from); -typedef ZEND_RESULT_CODE (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); +typedef zend_result (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(void); -typedef ZEND_RESULT_CODE (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); +typedef zend_result (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); typedef struct _zend_multibyte_functions { const char *provider_name; @@ -57,7 +57,7 @@ ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16le; ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf8; /* multibyte utility functions */ -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_functions(const zend_multibyte_functions *functions); +ZEND_API zend_result zend_multibyte_set_functions(const zend_multibyte_functions *functions); ZEND_API void zend_multibyte_restore_functions(void); ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void); @@ -72,7 +72,7 @@ ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void); ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void); ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size); ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding); -ZEND_API ZEND_RESULT_CODE zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); +ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); END_EXTERN_C() diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index fea8ae3340275..9348ec9a74311 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -232,7 +232,7 @@ static zend_never_inline zval* ZEND_FASTCALL _zendi_convert_scalar_to_number_sil } /* }}} */ -static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { switch (Z_TYPE_P(op)) { case IS_NULL: @@ -274,7 +274,7 @@ static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL _zendi_try_convert_scala } /* }}} */ -static zend_always_inline ZEND_RESULT_CODE zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_always_inline zend_result zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { if (Z_TYPE_P(op) == IS_LONG || Z_TYPE_P(op) == IS_DOUBLE) { ZVAL_COPY_VALUE(holder, op); @@ -963,7 +963,7 @@ static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zva } /* }}} */ -static zend_always_inline ZEND_RESULT_CODE add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -987,7 +987,7 @@ static zend_always_inline ZEND_RESULT_CODE add_function_fast(zval *result, zval } } /* }}} */ -static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1019,7 +1019,7 @@ static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL add_function_slow(zval * return FAILURE; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (add_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1029,7 +1029,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL add_function(zval *result, zval *op1, zv } /* }}} */ -static zend_always_inline ZEND_RESULT_CODE sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1051,7 +1051,7 @@ static zend_always_inline ZEND_RESULT_CODE sub_function_fast(zval *result, zval } /* }}} */ -static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1084,7 +1084,7 @@ static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL sub_function_slow(zval * } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (sub_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1094,7 +1094,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL sub_function(zval *result, zval *op1, zv } /* }}} */ -static zend_always_inline ZEND_RESULT_CODE mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1120,7 +1120,7 @@ static zend_always_inline ZEND_RESULT_CODE mul_function_fast(zval *result, zval } /* }}} */ -static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1153,7 +1153,7 @@ static zend_never_inline ZEND_RESULT_CODE ZEND_FASTCALL mul_function_slow(zval * } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (mul_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1163,7 +1163,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mul_function(zval *result, zval *op1, zv } /* }}} */ -static ZEND_RESULT_CODE ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1220,7 +1220,7 @@ static ZEND_RESULT_CODE ZEND_FASTCALL pow_function_base(zval *result, zval *op1, } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1256,7 +1256,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL pow_function(zval *result, zval *op1, zv #ifdef __clang__ __attribute__((no_sanitize("float-divide-by-zero"))) #endif -static ZEND_RESULT_CODE ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1300,7 +1300,7 @@ static ZEND_RESULT_CODE ZEND_FASTCALL div_function_base(zval *result, zval *op1, } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1333,7 +1333,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL div_function(zval *result, zval *op1, zv } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1367,7 +1367,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mod_function(zval *result, zval *op1, zv } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { int op1_val, op2_val; @@ -1417,7 +1417,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_xor_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ { if (Z_TYPE_P(op1) < IS_TRUE) { ZVAL_TRUE(result); @@ -1442,7 +1442,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_not_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -1482,7 +1482,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_not_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1564,7 +1564,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_or_function(zval *result, zval * } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1646,7 +1646,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_and_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1728,7 +1728,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_xor_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1765,7 +1765,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_left_function(zval *result, zval * } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1801,7 +1801,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_right_function(zval *result, zval } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zval *orig_op1 = op1; zval op1_copy, op2_copy; @@ -1992,7 +1992,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_LONG(result, zend_compare(op1, op2)); return SUCCESS; @@ -2218,42 +2218,42 @@ ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, !zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_compare(op1, op2) == 0); return SUCCESS; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) != 0)); return SUCCESS; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) < 0)); return SUCCESS; } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0)); return SUCCESS; @@ -2396,7 +2396,7 @@ static void ZEND_FASTCALL increment_string(zval *str) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -2461,7 +2461,7 @@ ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ { zend_long lval; double dval; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 4c09ce3761624..efc2990ec0cd7 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -38,30 +38,30 @@ #define LONG_SIGN_MASK ZEND_LONG_MIN BEGIN_EXTERN_C() -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); +ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); +ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce); ZEND_API zend_bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *instance_ce, const zend_class_entry *ce); @@ -255,8 +255,8 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const } } -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL increment_function(zval *op1); -ZEND_API ZEND_RESULT_CODE ZEND_FASTCALL decrement_function(zval *op2); +ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1); +ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op2); ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op); ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op); @@ -738,7 +738,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline ZEND_RESULT_CODE fast_add_function(zval *result, zval *op1, zval *op2) +static zend_always_inline zend_result fast_add_function(zval *result, zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { @@ -842,7 +842,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline ZEND_RESULT_CODE fast_div_function(zval *result, zval *op1, zval *op2) +static zend_always_inline zend_result fast_div_function(zval *result, zval *op1, zval *op2) { return div_function(result, op1, op2); } diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index 79043b199ea60..80feecd98ff3a 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -281,7 +281,7 @@ ZEND_API void zend_signal(int signo, void (*handler)(int)) * Set a handler for a signal we want to defer. * Previously set handler must have been saved before. */ -static ZEND_RESULT_CODE zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) +static zend_result zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) { struct sigaction sa; diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 18419457b1376..1dfc5b1bc1e89 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -73,7 +73,7 @@ ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *fi handle->filename = filename; } -ZEND_API ZEND_RESULT_CODE zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ +ZEND_API zend_result zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ { zend_string *opened_path; if (zend_stream_open_function) { @@ -113,7 +113,7 @@ static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len); } /* }}} */ -ZEND_API ZEND_RESULT_CODE zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ +ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ { size_t file_size; diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 57ddc3df15f43..023e2d0555a4d 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -66,8 +66,8 @@ typedef struct _zend_file_handle { BEGIN_EXTERN_C() ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename); ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename); -ZEND_API ZEND_RESULT_CODE zend_stream_open(const char *filename, zend_file_handle *handle); -ZEND_API ZEND_RESULT_CODE zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); +ZEND_API zend_result zend_stream_open(const char *filename, zend_file_handle *handle); +ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); END_EXTERN_C() diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index 425ee7d13289e..d4e972d0e3e5d 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -186,9 +186,9 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun end_write(ht); } -ZEND_API ZEND_RESULT_CODE zend_ts_hash_del(TsHashTable *ht, zend_string *key) +ZEND_API zend_result zend_ts_hash_del(TsHashTable *ht, zend_string *key) { - ZEND_RESULT_CODE retval; + zend_result retval; begin_write(ht); retval = zend_hash_del(TS_HASH(ht), key); @@ -197,9 +197,9 @@ ZEND_API ZEND_RESULT_CODE zend_ts_hash_del(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API ZEND_RESULT_CODE zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) +ZEND_API zend_result zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) { - ZEND_RESULT_CODE retval; + zend_result retval; begin_write(ht); retval = zend_hash_index_del(TS_HASH(ht), h); diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 2f4e5575f19dd..51801e4e05f17 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -56,8 +56,8 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun /* Deletes */ -ZEND_API ZEND_RESULT_CODE zend_ts_hash_del(TsHashTable *ht, zend_string *key); -ZEND_API ZEND_RESULT_CODE zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); +ZEND_API zend_result zend_ts_hash_del(TsHashTable *ht, zend_string *key); +ZEND_API zend_result zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); /* Data retrieval */ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key); diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index dab7fdca3b0d0..250d1704dcf19 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -1178,7 +1178,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func } /* }}} */ -CWD_API ZEND_RESULT_CODE virtual_chdir(const char *path) /* {{{ */ +CWD_API zend_result virtual_chdir(const char *path) /* {{{ */ { return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH) ? FAILURE : SUCCESS; } diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index a650f99447f86..e32ed281ee71c 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -296,11 +296,11 @@ static size_t count_commas(const char *p, const char *end) { return count; } -/* {{{ static ZEND_RESULT_CODE php_mb_parse_encoding_list() +/* {{{ static zend_result php_mb_parse_encoding_list() * Return FAILURE if input contains any illegal encoding, otherwise SUCCESS. * Emits a ValueError in function context and a warning in INI context, in INI context arg_num must be 0. */ -static ZEND_RESULT_CODE php_mb_parse_encoding_list(const char *value, size_t value_length, +static zend_result php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_encoding ***return_list, size_t *return_size, bool persistent, uint32_t arg_num, zend_bool allow_pass_encoding) { @@ -521,7 +521,7 @@ static size_t php_mb_zend_encoding_converter(unsigned char **to, size_t *to_leng return loc; } -static ZEND_RESULT_CODE php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) +static zend_result php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return php_mb_parse_encoding_list( encoding_list, encoding_list_len, @@ -534,7 +534,7 @@ static const zend_encoding *php_mb_zend_internal_encoding_getter(void) return (const zend_encoding *)MBSTRG(internal_encoding); } -static ZEND_RESULT_CODE php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) +static zend_result php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) { MBSTRG(internal_encoding) = (const mbfl_encoding *)encoding; return SUCCESS; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 9bd2ab15e1386..9ee1a5b5d7243 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -119,15 +119,15 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */ #endif static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); -static ZEND_RESULT_CODE (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); +static zend_result (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len); static void (*accelerator_orig_zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); static zif_handler orig_chdir = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; -static ZEND_RESULT_CODE (*orig_post_startup_cb)(void); +static zend_result (*orig_post_startup_cb)(void); static void accel_gen_system_id(void); -static ZEND_RESULT_CODE accel_post_startup(void); +static zend_result accel_post_startup(void); static int accel_finish_startup(void); static void preload_shutdown(void); @@ -304,7 +304,7 @@ static inline int accel_restart_is_active(void) } /* Creates a read lock for SHM access */ -static inline ZEND_RESULT_CODE accel_activate_add(void) +static inline zend_result accel_activate_add(void) { #ifdef ZEND_WIN32 SHM_UNPROTECT(); @@ -2269,7 +2269,7 @@ static int accel_gen_uname_id(void) #endif /* zend_stream_open_function() replacement for PHP 5.3 and above */ -static ZEND_RESULT_CODE persistent_stream_open_function(const char *filename, zend_file_handle *handle) +static zend_result persistent_stream_open_function(const char *filename, zend_file_handle *handle) { if (ZCG(cache_persistent_script)) { /* check if callback is called from include_once or it's a main request */ @@ -2400,7 +2400,7 @@ static void accel_reset_pcre_cache(void) } ZEND_HASH_FOREACH_END(); } -ZEND_RESULT_CODE accel_activate(INIT_FUNC_ARGS) +zend_result accel_activate(INIT_FUNC_ARGS) { if (!ZCG(enabled) || !accel_startup_ok) { ZCG(accelerator_enabled) = 0; @@ -2963,13 +2963,13 @@ static int accel_startup(zend_extension *extension) return SUCCESS; } -static ZEND_RESULT_CODE accel_post_startup(void) +static zend_result accel_post_startup(void) { zend_function *func; zend_ini_entry *ini_entry; if (orig_post_startup_cb) { - ZEND_RESULT_CODE (*cb)(void) = orig_post_startup_cb; + zend_result (*cb)(void) = orig_post_startup_cb; orig_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -4368,7 +4368,7 @@ static void preload_load(void) } } -static ZEND_RESULT_CODE preload_autoload(zend_string *filename) +static zend_result preload_autoload(zend_string *filename) { zend_persistent_script *persistent_script; zend_op_array *op_array; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index a0749cb22d33a..0d6dda86a1256 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -316,7 +316,7 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; void accel_shutdown(void); -ZEND_RESULT_CODE accel_activate(INIT_FUNC_ARGS); +zend_result accel_activate(INIT_FUNC_ARGS); int accel_post_deactivate(void); void zend_accel_schedule_restart(zend_accel_restart_reason reason); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); diff --git a/main/main.c b/main/main.c index a02a6698918bb..c9cb9b2d8563b 100644 --- a/main/main.c +++ b/main/main.c @@ -1521,13 +1521,13 @@ static size_t php_zend_stream_fsizer(void *handle) /* {{{ */ } /* }}} */ -static ZEND_RESULT_CODE php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ +static zend_result php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ { return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE); } /* }}} */ -PHPAPI ZEND_RESULT_CODE php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ +PHPAPI zend_result php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ { zend_string *opened_path; php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &opened_path); From bbc67c49b7bd04da3fba3ae20579c4726caf3de8 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 23 Aug 2020 22:35:01 +0200 Subject: [PATCH 61/65] Attempt to fix some variable types in VM due to JIT failures --- Zend/zend_vm_def.h | 12 +++++++----- Zend/zend_vm_execute.h | 30 +++++++++++++++++------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 9f735c5a4c8ed..00bb179561f0f 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6962,6 +6962,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH| { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -7007,17 +7008,18 @@ ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, ANY, CLASS_FETCH, ISSET|CAC { USE_OPLINE zval *value; - int result; + zend_result fetch_result; + bool result; SAVE_OPLINE(); - result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); + fetch_result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); if (!(opline->extended_value & ZEND_ISEMPTY)) { - result = result == SUCCESS && Z_TYPE_P(value) > IS_NULL && + result = fetch_result == SUCCESS && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); } else { - result = result != SUCCESS || !i_zend_is_true(value); + result = fetch_result != SUCCESS || !i_zend_is_true(value); } ZEND_VM_SMART_BRANCH(result, 1); @@ -7027,7 +7029,7 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|CV { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 1e0bfabe381cd..e6712b86afbca 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2405,17 +2405,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC { USE_OPLINE zval *value; - int result; + zend_result fetch_result; + bool result; SAVE_OPLINE(); - result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); + fetch_result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); if (!(opline->extended_value & ZEND_ISEMPTY)) { - result = result == SUCCESS && Z_TYPE_P(value) > IS_NULL && + result = fetch_result == SUCCESS && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); } else { - result = result != SUCCESS || !i_zend_is_true(value); + result = fetch_result != SUCCESS || !i_zend_is_true(value); } ZEND_VM_SMART_BRANCH(result, 1); @@ -6315,7 +6316,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -8471,7 +8472,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -9425,6 +9426,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -10854,7 +10856,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -14997,7 +14999,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -16389,7 +16391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -16787,6 +16789,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_ { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -17702,7 +17705,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -41169,7 +41172,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -44617,7 +44620,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -46324,6 +46327,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -49739,7 +49743,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; From a953eaadb509c9a3294e5d2f4e181dc861383097 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 24 Aug 2020 16:29:31 +0200 Subject: [PATCH 62/65] Partial revert of 'Shot in the dark to fix JIT' --- Zend/zend_operators.c | 6 +++--- Zend/zend_operators.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 9348ec9a74311..3488292461630 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2524,13 +2524,13 @@ ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ { return i_zend_is_true(op); } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ { zend_object *zobj = Z_OBJ_P(op); zval tmp; @@ -2538,7 +2538,7 @@ ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ return Z_TYPE(tmp) == IS_TRUE; } zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name)); - return 1; + return false; } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index efc2990ec0cd7..9f749e4a31e4d 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -341,8 +341,8 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); } -ZEND_API int ZEND_FASTCALL zend_is_true(zval *op); -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op); +ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op); +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op); #define zval_is_true(op) \ zend_is_true(op) From 3bc1ce8abdbf695b63b342bb1d3b058d73d839ec Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 24 Aug 2020 17:03:02 +0200 Subject: [PATCH 63/65] Other change to see if this is root cause of JIT failure Might be due to EXT_CALL zend_is_true, r0 in zend_jit_x86.dasc line 7932 --- Zend/zend_operators.c | 4 ++-- Zend/zend_operators.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 3488292461630..7de4cd8ad7ad1 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2524,9 +2524,9 @@ ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ } /* }}} */ -ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ +ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ { - return i_zend_is_true(op); + return (int) i_zend_is_true(op); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 9f749e4a31e4d..d543b7b03c2bb 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -341,15 +341,15 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); } -ZEND_API bool ZEND_FASTCALL zend_is_true(zval *op); +ZEND_API int ZEND_FASTCALL zend_is_true(zval *op); ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op); #define zval_is_true(op) \ zend_is_true(op) -static zend_always_inline int i_zend_is_true(zval *op) +static zend_always_inline bool i_zend_is_true(zval *op) { - int result = 0; + bool result = 0; again: switch (Z_TYPE_P(op)) { From 85dc37f2fc7aaa9f0a4e96612339690aa19c3e50 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 25 Aug 2020 15:25:47 +0200 Subject: [PATCH 64/65] Fix spurious change --- Zend/zend_exceptions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 709dfa14c727b..7184f5bf68c6b 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -1,4 +1,4 @@ - /* +/* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ From 9ffcda208af6075b72eadbc74153724225013667 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 26 Aug 2020 19:21:32 +0200 Subject: [PATCH 65/65] Update UPGRADING.INTERNALS --- UPGRADING.INTERNALS | 184 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 183 insertions(+), 1 deletion(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 404f5f9c67de8..301faf16cdcff 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -158,6 +158,28 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_fcall_info_argp() - zend_fcall_info_argv() - zend_fcall_info_argn() + - zend_startup() + - zend_set_memory_limit() + - pass_two() + - zend_startup_constants() + - zend_shutdown_constants() + - zend_startup_extensions_mechanism() + - zend_startup_extensions() + - zend_register_extension() + - highlight_string() + - zend_ini_startup() + - zend_ini_shutdown() + - zend_ini_global_shutdown() + - zend_ini_deactivate() + - zend_copy_ini_directives() + - zend_prepare_string_for_scanning() + - zend_init_rsrc_list() + - zend_list_close() + - zend_signal() + - zend_sigaction() + - zend_stack_init() + - zend_stack_del_top() + - zend_stack_destroy() 2. Argument int to uint32_t in Zend Engine 4.0: - _zend_get_parameters_array_ex() - zend_copy_parameters_array() @@ -169,8 +191,39 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_wrong_parameter*() - zend_wrong_callback_error() - zend_parse_arg_class() - 3. Argument int to zend_bool in Zend Engine 4.0: + 3. Argument int to bool in Zend Engine 4.0: - add_next_index_bool() + - zend_register_class_alias_ex() + - add_assoc_bool_ex() + - add_index_bool() + - zend_fcall_info_args_clear() + - zend_set_local_var() + - zend_set_local_var_str() + - zend_parse_arg_*() + - shutdown_memory_manager() + - zend_memory_usage() + - zend_memory_peak_usage() + - zend_mm_shutdown() + - zend_eval_string*() + - zend_set_timeout() + - _zend_hash_append_ex() + - _zend_hash_append_ptr_ex() + - zend_alter_ini_entry_ex() + - (*zend_encoding_list_parser) typedef + - zend_multibyte_parse_encoding_list() + - zend_safe_address() + - zend_string_tolower_ex() + - zend_string_alloc() + - zend_string_safe_alloc() + - zend_string_init() + - zend_string_dup() + - zend_string_realloc() + - zend_string_extend() + - zend_string_truncate() + - zend_string_safe_realloc() + - zend_string_release_ex() + - zend_ts_hash_merge() + - zend_ts_hash_sort() 4. Argument int to size_t in Zend Engine 4.0: - zend_set_hash_symbol() 5. Argument zval* to zend_object* in Zend Engine 4.0: @@ -185,6 +238,135 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_get_exception_base() 6. Argument zval* to zend_long in Zend Engine 4.0: - _php_math_longtobase() + 7. Return type from int to zend_result in Zend Engine 4.0: + - (*stream_open_function) in _zend_utility_functions + - (*zend_post_startup_cb) + - (*zend_preload_autoload) + - zend_execute_scripts() + - zend_post_startup() + - _zend_get_parameters_array_ex() + - zend_copy_parameters_array() + - zend_parse_parameters() + - zend_parse_parameters_ex() + - zend_parse_method_parameters() + - zend_parse_method_parameters_ex() + - zend_parse_method_parameters() + - zend_register_functions() + - zend_startup_module() + - zend_startup_module_ex() + - zend_register_class_alias_ex() + - zend_disable_function() + - zend_disable_class() + - zend_update_class_constants() + - zend_update_static_property*() + - object_init_ex() + - object_and_properties_init() + - add_index_zval() + - add_next_index_long_*() + - array_set_zval_key() + - _call_user_function_impl() + - zend_fcall_info_*() + - zend_call_function() + - zend_set_hash_symbol() + - zend_delete_global_variable() + - zend_set_local_var() + - zend_set_local_var_str() + - zend_forbid_dynamic_call() + - zend_get_default_from_internal_arg_info() + - zend_try_assign_typed_ref*() + - zend_ast_evaluate() + - zend_startup_builtin_functions() + - do_bind_function() + - do_bind_class() + - zend_unmangle_property_name_ex() + - zend_register_auto_global() + - zend_register_constant() + - zend_exception_error() + - zend_eval_string*() + - zend_undefined_offset_write() + - zend_undefined_index_write() + - zval_update_constant(_ex)() + - zend_load_extension() + - zend_load_extension_handle() + - zend_hash_del(_ind)() + - zend_hash_str_del(_ind)() + - zend_hash_index_del() + - zend_hash_move_forward_ex() + - zend_hash_move_backward_ex() + - zend_hash_get_current_key_ex() + - zend_hash_get_current_key_type_ex() + - zend_symtable_del(_ind)() + - zend_symtable_str_del(_ind)() + - highlight_file() + - zend_do_link_class() + - zend_alter_ini_entry*() + - zend_restore_ini_entry() + - zend_ini_register_displayer() + - zend_ini_open_file_for_scanning() + - zend_ini_prepare_string_for_scanning() + - zend_user_it_valid() + - zend_create_internal_iterator_zval() + - zend_multibyte_set_filter() + - zend_lex_tstring() + - _zend_module_entry module_startup_func, module_shutdown_func, + request_startup_func, and request_shutdown_func function pointers + - (*zend_encoding_list_parser) typedef + - (*zend_encoding_internal_encoding_setter) typedef + - zend_multibyte_set_functions() + - zend_multibyte_set_script_encoding_by_string() + - add_function() + - sub_function() + - mul_function() + - pow_function() + - div_function() + - mod_function() + - boolean_xor_function() + - boolean_not_function() + - bitwise_not_function() + - bitwise_or_function() + - bitwise_and_function() + - bitwise_xor_function() + - shift_left_function() + - shift_right_function() + - concat_function() + - is_equal_function( + - is_identical_function() + - is_not_identical_function() + - is_not_equal_function() + - is_smaller_function() + - is_smaller_or_equal_function(zv + - increment_function() + - decrement_function() + - zend_stream_open() + - zend_stream_fixup() + - zend_ts_hash_del() + - zend_ts_hash_index_del() + 8. Return type from int to bool in Zend Engine 4.0: + - zend_make_printable_zval() + - zend_parse_arg_*() + - is_zend_mm() + - is_zend_ptr() + - zend_mm_is_custom_heap() + - (*zend_mm_chunk_truncate_t) + - (*zend_mm_chunk_extend_t) + - zend_bitset_empty() + - zend_is_smart_branch() + - zend_check_arg_send_type() + - zend_verify_const_access() + - zend_gdb_register_code() + - zend_gdb_present() + - _zend_handle_numeric_str(_ex)() + - zend_hash_exists_ind() + - zend_hash_str_exists_ind() + - zend_symtable_exists(_ind)() + - zend_symtable_str_exists() + - (*zend_encoding_lexer_compatibility_checker) + - zend_object_is_true() + - i_zend_is_true() + - zendi_smart_streq() + - zend_stack_is_empty() + - zend_ts_hash_exists() + - zend_ts_hash_index_exists() u. Instead of overwriting zend_error_cb extensions with debugging, monitoring use-cases catching Errors/Exceptions are strongly encouraged to use