From: George Peter Banyard Date: Fri, 3 Jul 2020 15:43:06 +0000 (+0200) Subject: Voidify some ZEND_API functions X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9839752a9c364dcec6e3c6f15f25987498486171;p=php Voidify some ZEND_API functions Closes GH-5805 --- diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index a9a6553466..6e2c8e57fd 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -20,6 +20,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES q. GC_COLLECTABLE flag r. Cannot implement Traversable only s. zend_fcall_info no_separation flag removed + t. Signature changes 2. Build system changes a. Abstract @@ -89,7 +90,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES j. compare_objects() handler was removed. Extensions should use compare() object handler instead and check if both arguments are objects and have the same compare handler, using ZEND_COMPARE_OBJECTS_FALLBACK() macro. - + k. The 'I' length modifier, used to denote 32 and 64bit integer from the custom snprintf and spprintf implementations has been removed. Use the ZEND_LONG_FMT, ZEND_ULONG_FMT and ZEND_XLONG_FMT macros defined in @@ -136,11 +137,22 @@ PHP 8.0 INTERNALS UPGRADE NOTES zend_create_internal_iterator_zval(return_value, ZEND_THIS); } - s. The zend_fcall_info no_separation flag has been removed, and separation is + s. The zend_fcall_info no_separation flag has been removed, and separation is never allowed. If you wish to pass (or allow passing) arguments by reference, explicitly create those arguments as references using ZEND_MAKE_REF. + t. The following ZEND_API function have changed signature: + 1. Void in Zend Engine 4.0: + - add_assoc_*() + - add_index_*() + - add_property_*() + - object_init() + - zend_declare_class_constant*() + - zend_declare_property*() + - zend_startup_modules() + - zend_wrong_parameters_none_error() + ======================== 2. Build system changes ======================== diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 8fd319ea2e..cbf6bdcd09 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -180,22 +180,18 @@ ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg) /* {{{ */ } /* }}} */ -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* {{{ */ { int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data)); zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; zend_argument_count_error( - "%s%s%s() expects %s %d parameter%s, %d given", + "%s%s%s() expects exactly 0 parameters, %d given", class_name, \ class_name[0] ? "::" : "", \ ZSTR_VAL(active_function->common.function_name), - "exactly", - 0, - "s", num_args); - return FAILURE; } /* }}} */ @@ -1373,177 +1369,159 @@ ZEND_API int object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ } /* }}} */ -ZEND_API int object_init(zval *arg) /* {{{ */ +ZEND_API void object_init(zval *arg) /* {{{ */ { ZVAL_OBJ(arg, zend_objects_new(zend_standard_class_def)); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_long_ex(zval *arg, const char *key, size_t key_len, zend_long n) /* {{{ */ +ZEND_API void add_assoc_long_ex(zval *arg, const char *key, size_t key_len, zend_long n) /* {{{ */ { zval tmp; ZVAL_LONG(&tmp, n); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_null_ex(zval *arg, const char *key, size_t key_len) /* {{{ */ +ZEND_API void add_assoc_null_ex(zval *arg, const char *key, size_t key_len) /* {{{ */ { zval tmp; ZVAL_NULL(&tmp); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int 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, int b) /* {{{ */ { zval tmp; ZVAL_BOOL(&tmp, b); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r) /* {{{ */ +ZEND_API void add_assoc_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r) /* {{{ */ { zval tmp; ZVAL_RES(&tmp, r); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, size_t key_len, double d) /* {{{ */ +ZEND_API void add_assoc_double_ex(zval *arg, const char *key, size_t key_len, double d) /* {{{ */ { zval tmp; ZVAL_DOUBLE(&tmp, d); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str) /* {{{ */ +ZEND_API void add_assoc_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str) /* {{{ */ { zval tmp; ZVAL_STR(&tmp, str); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, const char *str) /* {{{ */ +ZEND_API void add_assoc_string_ex(zval *arg, const char *key, size_t key_len, const char *str) /* {{{ */ { zval tmp; ZVAL_STRING(&tmp, str); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length) /* {{{ */ +ZEND_API void add_assoc_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length) /* {{{ */ { zval tmp; ZVAL_STRINGL(&tmp, str, length); zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */ +ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */ { zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, value); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_long(zval *arg, zend_ulong index, zend_long n) /* {{{ */ +ZEND_API void add_index_long(zval *arg, zend_ulong index, zend_long n) /* {{{ */ { zval tmp; ZVAL_LONG(&tmp, n); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_null(zval *arg, zend_ulong index) /* {{{ */ +ZEND_API void add_index_null(zval *arg, zend_ulong index) /* {{{ */ { zval tmp; ZVAL_NULL(&tmp); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */ +ZEND_API void add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */ { zval tmp; ZVAL_BOOL(&tmp, b); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_resource(zval *arg, zend_ulong index, zend_resource *r) /* {{{ */ +ZEND_API void add_index_resource(zval *arg, zend_ulong index, zend_resource *r) /* {{{ */ { zval tmp; ZVAL_RES(&tmp, r); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_double(zval *arg, zend_ulong index, double d) /* {{{ */ +ZEND_API void add_index_double(zval *arg, zend_ulong index, double d) /* {{{ */ { zval tmp; ZVAL_DOUBLE(&tmp, d); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */ +ZEND_API void add_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */ { zval tmp; ZVAL_STR(&tmp, str); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */ +ZEND_API void add_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */ { zval tmp; ZVAL_STRING(&tmp, str); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ -ZEND_API int add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length) /* {{{ */ +ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length) /* {{{ */ { zval tmp; ZVAL_STRINGL(&tmp, str, length); zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); - return SUCCESS; } /* }}} */ @@ -1660,94 +1638,89 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ } /* }}} */ -ZEND_API int add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long n) /* {{{ */ +ZEND_API void add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long n) /* {{{ */ { zval tmp; ZVAL_LONG(&tmp, n); - return add_property_zval_ex(arg, key, key_len, &tmp); + add_property_zval_ex(arg, key, key_len, &tmp); } /* }}} */ -ZEND_API int add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b) /* {{{ */ +ZEND_API void add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b) /* {{{ */ { zval tmp; ZVAL_BOOL(&tmp, b); - return add_property_zval_ex(arg, key, key_len, &tmp); + add_property_zval_ex(arg, key, key_len, &tmp); } /* }}} */ -ZEND_API int add_property_null_ex(zval *arg, const char *key, size_t key_len) /* {{{ */ +ZEND_API void add_property_null_ex(zval *arg, const char *key, size_t key_len) /* {{{ */ { zval tmp; ZVAL_NULL(&tmp); - return add_property_zval_ex(arg, key, key_len, &tmp); + add_property_zval_ex(arg, key, key_len, &tmp); } /* }}} */ -ZEND_API int add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r) /* {{{ */ +ZEND_API void add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r) /* {{{ */ { zval tmp; ZVAL_RES(&tmp, r); add_property_zval_ex(arg, key, key_len, &tmp); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; } /* }}} */ -ZEND_API int add_property_double_ex(zval *arg, const char *key, size_t key_len, double d) /* {{{ */ +ZEND_API void add_property_double_ex(zval *arg, const char *key, size_t key_len, double d) /* {{{ */ { zval tmp; ZVAL_DOUBLE(&tmp, d); - return add_property_zval_ex(arg, key, key_len, &tmp); + add_property_zval_ex(arg, key, key_len, &tmp); } /* }}} */ -ZEND_API int add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str) /* {{{ */ +ZEND_API void add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str) /* {{{ */ { zval tmp; ZVAL_STR(&tmp, str); add_property_zval_ex(arg, key, key_len, &tmp); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; } /* }}} */ -ZEND_API int add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str) /* {{{ */ +ZEND_API void add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str) /* {{{ */ { zval tmp; ZVAL_STRING(&tmp, str); add_property_zval_ex(arg, key, key_len, &tmp); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; } /* }}} */ -ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length) /* {{{ */ +ZEND_API void add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length) /* {{{ */ { zval tmp; ZVAL_STRINGL(&tmp, str, length); add_property_zval_ex(arg, key, key_len, &tmp); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; } /* }}} */ -ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */ +ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */ { zend_string *str; str = zend_string_init(key, key_len, 0); Z_OBJ_HANDLER_P(arg, write_property)(Z_OBJ_P(arg), str, value, NULL); zend_string_release_ex(str, 0); - return SUCCESS; } /* }}} */ @@ -1921,11 +1894,10 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ } /* }}} */ -ZEND_API int zend_startup_modules(void) /* {{{ */ +ZEND_API void zend_startup_modules(void) /* {{{ */ { zend_hash_sort_ex(&module_registry, zend_sort_modules, NULL, 0); zend_hash_apply(&module_registry, zend_startup_module_zval); - return SUCCESS; } /* }}} */ @@ -3764,73 +3736,71 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze } /* }}} */ -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */ +ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */ { zend_declare_typed_property(ce, name, property, access_type, doc_comment, (zend_type) ZEND_TYPE_INIT_NONE(0)); - return SUCCESS; } /* }}} */ -ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type) /* {{{ */ +ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type) /* {{{ */ { zend_string *key = zend_string_init(name, name_length, is_persistent_class(ce)); - int ret = zend_declare_property_ex(ce, key, property, access_type, NULL); + zend_declare_property_ex(ce, key, property, access_type, NULL); zend_string_release(key); - return ret; } /* }}} */ -ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type) /* {{{ */ { zval property; ZVAL_NULL(&property); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */ { zval property; ZVAL_BOOL(&property, value); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */ { zval property; ZVAL_LONG(&property, value); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ -ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type) /* {{{ */ { zval property; ZVAL_DOUBLE(&property, value); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ -ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type) /* {{{ */ { zval property; ZVAL_NEW_STR(&property, zend_string_init(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS)); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ -ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type) /* {{{ */ +ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type) /* {{{ */ { zval property; ZVAL_NEW_STR(&property, zend_string_init(value, value_len, ce->type & ZEND_INTERNAL_CLASS)); - return zend_declare_property(ce, name, name_length, &property, access_type); + zend_declare_property(ce, name, name_length, &property, access_type); } /* }}} */ @@ -3876,7 +3846,7 @@ ZEND_API zend_class_constant *zend_declare_class_constant_ex(zend_class_entry *c } /* }}} */ -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) /* {{{ */ +ZEND_API void zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) /* {{{ */ { zend_string *key; @@ -3887,58 +3857,57 @@ ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, } zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL); zend_string_release(key); - return SUCCESS; } /* }}} */ -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) /* {{{ */ +ZEND_API void zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) /* {{{ */ { zval constant; ZVAL_NULL(&constant); - return zend_declare_class_constant(ce, name, name_length, &constant); + zend_declare_class_constant(ce, name, name_length, &constant); } /* }}} */ -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API void zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval constant; ZVAL_LONG(&constant, value); - return zend_declare_class_constant(ce, name, name_length, &constant); + zend_declare_class_constant(ce, name, name_length, &constant); } /* }}} */ -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value) /* {{{ */ +ZEND_API void zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value) /* {{{ */ { zval constant; ZVAL_BOOL(&constant, value); - return zend_declare_class_constant(ce, name, name_length, &constant); + zend_declare_class_constant(ce, name, name_length, &constant); } /* }}} */ -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value) /* {{{ */ +ZEND_API void zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value) /* {{{ */ { zval constant; ZVAL_DOUBLE(&constant, value); - return zend_declare_class_constant(ce, name, name_length, &constant); + zend_declare_class_constant(ce, name, name_length, &constant); } /* }}} */ -ZEND_API int 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_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length) /* {{{ */ { zval constant; ZVAL_NEW_STR(&constant, zend_string_init(value, value_length, ce->type & ZEND_INTERNAL_CLASS)); - return zend_declare_class_constant(ce, name, name_length, &constant); + zend_declare_class_constant(ce, name, name_length, &constant); } /* }}} */ -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value) /* {{{ */ +ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value) /* {{{ */ { - return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value)); + zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value)); } /* }}} */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0d019711cb..da55826b9e 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -315,7 +315,7 @@ ZEND_API int 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 int zend_startup_modules(void); +ZEND_API void zend_startup_modules(void); ZEND_API void zend_collect_module_handlers(void); ZEND_API void zend_destroy_modules(void); ZEND_API void zend_check_magic_method_implementation( @@ -352,23 +352,23 @@ ZEND_API int zend_get_module_started(const char *module_name); ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment, zend_type type); -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment); -ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type); -ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type); -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type); -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type); -ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type); -ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type); -ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type); +ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment); +ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type); +ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type); +ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type); +ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type); +ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type); +ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type); +ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type); ZEND_API zend_class_constant *zend_declare_class_constant_ex(zend_class_entry *ce, zend_string *name, zval *value, int access_type, zend_string *doc_comment); -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value); -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length); -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value); -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value); -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value); -ZEND_API int 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 int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value); +ZEND_API void zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value); +ZEND_API void zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length); +ZEND_API void zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value); +ZEND_API void zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value); +ZEND_API void zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value); +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); @@ -417,7 +417,7 @@ 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 int object_init(zval *arg); +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 void object_properties_init(zend_object *object, zend_class_entry *class_type); @@ -426,15 +426,15 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties) ZEND_API void zend_merge_properties(zval *obj, HashTable *properties); -ZEND_API int add_assoc_long_ex(zval *arg, const char *key, size_t key_len, zend_long n); -ZEND_API int add_assoc_null_ex(zval *arg, const char *key, size_t key_len); -ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, int b); -ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r); -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, size_t key_len, double d); -ZEND_API int add_assoc_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str); -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, const char *str); -ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length); -ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value); +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_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); +ZEND_API void add_assoc_string_ex(zval *arg, const char *key, size_t key_len, const char *str); +ZEND_API void add_assoc_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length); +ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value); #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key)) @@ -446,14 +446,14 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval #define add_assoc_stringl(__arg, __key, __str, __length) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length) #define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key), __value) -ZEND_API int add_index_long(zval *arg, zend_ulong index, zend_long n); -ZEND_API int add_index_null(zval *arg, zend_ulong index); -ZEND_API int add_index_bool(zval *arg, zend_ulong index, int b); -ZEND_API int add_index_resource(zval *arg, zend_ulong index, zend_resource *r); -ZEND_API int add_index_double(zval *arg, zend_ulong index, double d); -ZEND_API int add_index_str(zval *arg, zend_ulong index, zend_string *str); -ZEND_API int add_index_string(zval *arg, zend_ulong index, const char *str); -ZEND_API int add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length); +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_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) { @@ -476,15 +476,15 @@ static zend_always_inline int add_next_index_zval(zval *arg, zval *value) ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value); -ZEND_API int add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l); -ZEND_API int add_property_null_ex(zval *arg, const char *key, size_t key_len); -ZEND_API int add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b); -ZEND_API int add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r); -ZEND_API int add_property_double_ex(zval *arg, const char *key, size_t key_len, double d); -ZEND_API int add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str); -ZEND_API int add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str); -ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length); -ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, 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); +ZEND_API void add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b); +ZEND_API void add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r); +ZEND_API void add_property_double_ex(zval *arg, const char *key, size_t key_len, double d); +ZEND_API void add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str); +ZEND_API void add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str); +ZEND_API void add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length); +ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key)) @@ -1229,7 +1229,7 @@ typedef enum _zend_expected_type { Z_EXPECTED_LAST } zend_expected_type; -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_none_error(void); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_num_args, int max_num_args); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, zend_expected_type expected_type, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg); diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y index 8802d18439..77df0eef6a 100644 --- a/ext/json/json_parser.y +++ b/ext/json/json_parser.y @@ -241,10 +241,10 @@ static int php_json_parser_object_create(php_json_parser *parser, zval *object) { if (parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) { array_init(object); - return SUCCESS; } else { - return object_init(object); + object_init(object); } + return SUCCESS; } static int php_json_parser_object_update(php_json_parser *parser, zval *object, zend_string *key, zval *zvalue)