diff options
Diffstat (limited to 'Zend/zend_API.h')
-rw-r--r-- | Zend/zend_API.h | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h index bdf3b1ce2b..67384041be 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -248,12 +248,12 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array); #define zend_parse_parameters_none() \ (EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : zend_wrong_parameters_none_error()) #define zend_parse_parameters_none_throw() \ - (EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : zend_wrong_parameters_none_exception()) + zend_parse_parameters_none() /* Parameter parsing API -- andrei */ +#define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */ #define ZEND_PARSE_PARAMS_QUIET (1<<1) -#define ZEND_PARSE_PARAMS_THROW (1<<2) ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...); ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...); ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ...); @@ -297,11 +297,8 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void); #define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0) #define IS_CALLABLE_CHECK_NO_ACCESS (1<<1) -#define IS_CALLABLE_CHECK_IS_STATIC (1<<2) #define IS_CALLABLE_CHECK_SILENT (1<<3) -#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) - ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc); ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *object); ZEND_API zend_string *zend_get_callable_name(zval *callable); @@ -472,7 +469,6 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->param_count = 0; * fci->params = NULL; * The callable_name argument may be NULL. - * Set check_flags to IS_CALLABLE_STRICT for every new usage! */ 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); @@ -638,7 +634,7 @@ END_EXTERN_C() #define RETURN_FALSE { RETVAL_FALSE; return; } #define RETURN_TRUE { RETVAL_TRUE; return; } -#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL))) +#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL))) #define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL) /* For compatibility */ @@ -1101,16 +1097,10 @@ typedef enum _zend_expected_type { } zend_expected_type; ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void); -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(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_parameters_count_exception(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_type_exception(int num, zend_expected_type expected_type, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error); #define ZPP_ERROR_OK 0 #define ZPP_ERROR_FAILURE 1 @@ -1144,11 +1134,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha (UNEXPECTED(_num_args > _max_num_args) && \ EXPECTED(_max_num_args >= 0))) { \ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \ - if (_flags & ZEND_PARSE_PARAMS_THROW) { \ - zend_wrong_parameters_count_exception(_min_num_args, _max_num_args); \ - } else { \ - zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \ - } \ + zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \ } \ _error_code = ZPP_ERROR_FAILURE; \ break; \ @@ -1171,23 +1157,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha if (UNEXPECTED(_error_code != ZPP_ERROR_OK)) { \ if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \ if (_error_code == ZPP_ERROR_WRONG_CALLBACK) { \ - if (_flags & ZEND_PARSE_PARAMS_THROW) { \ - zend_wrong_callback_exception(_i, _error); \ - } else { \ - zend_wrong_callback_error(_i, _error); \ - } \ + zend_wrong_callback_error(_i, _error); \ } else if (_error_code == ZPP_ERROR_WRONG_CLASS) { \ - if (_flags & ZEND_PARSE_PARAMS_THROW) { \ - zend_wrong_parameter_class_exception(_i, _error, _arg); \ - } else { \ - zend_wrong_parameter_class_error(_i, _error, _arg); \ - } \ + zend_wrong_parameter_class_error(_i, _error, _arg); \ } else if (_error_code == ZPP_ERROR_WRONG_ARG) { \ - if (_flags & ZEND_PARSE_PARAMS_THROW) { \ - zend_wrong_parameter_type_exception(_i, _expected_type, _arg); \ - } else { \ - zend_wrong_parameter_type_error(_i, _expected_type, _arg); \ - } \ + zend_wrong_parameter_type_error(_i, _expected_type, _arg); \ } \ } \ failure; \ @@ -1300,14 +1274,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha if (!_error) { \ _expected_type = Z_EXPECTED_FUNC; \ _error_code = ZPP_ERROR_WRONG_ARG; \ - break; \ } else { \ _error_code = ZPP_ERROR_WRONG_CALLBACK; \ - break; \ } \ - } else if (UNEXPECTED(_error != NULL)) { \ - zend_wrong_callback_deprecated(_i, _error); \ - } + break; \ + } \ #define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) \ Z_PARAM_FUNC_EX2(dest_fci, dest_fcc, check_null, separate, separate) @@ -1663,15 +1634,16 @@ static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **des if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) { *dest = Z_ARRVAL_P(arg); } else if (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { + zend_object *zobj = Z_OBJ_P(arg); if (separate - && Z_OBJ_P(arg)->properties - && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(arg)->properties) > 1)) { - if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(arg)->properties) & IS_ARRAY_IMMUTABLE))) { - GC_DELREF(Z_OBJ_P(arg)->properties); + && zobj->properties + && UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { + if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { + GC_DELREF(zobj->properties); } - Z_OBJ_P(arg)->properties = zend_array_dup(Z_OBJ_P(arg)->properties); + zobj->properties = zend_array_dup(zobj->properties); } - *dest = Z_OBJ_HT_P(arg)->get_properties(arg); + *dest = zobj->handlers->get_properties(zobj); } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { *dest = NULL; } else { |