(UNEXPECTED(_num_args > _max_num_args) && \
EXPECTED(_max_num_args >= 0))) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
- zend_wrong_parameters_count_error(_flags & ZEND_PARSE_PARAMS_THROW, _num_args, _min_num_args, _max_num_args); \
+ 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); \
+ } \
} \
- error_code = ZPP_ERROR_FAILURE; \
+ _error_code = ZPP_ERROR_FAILURE; \
break; \
} \
_i = 0; \
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args) \
ZEND_PARSE_PARAMETERS_START_EX(0, min_num_args, max_num_args)
+#define ZEND_PARSE_PARAMETERS_NONE() do { \
+ if (UNEXPECTED(ZEND_NUM_ARGS() != 0)) { \
+ zend_wrong_parameters_none_error(); \
+ return; \
+ } \
+ } while (0)
+
#define ZEND_PARSE_PARAMETERS_END_EX(failure) \
} while (0); \
- if (UNEXPECTED(error_code != ZPP_ERROR_OK)) { \
+ if (UNEXPECTED(_error_code != ZPP_ERROR_OK)) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
- if (error_code == ZPP_ERROR_WRONG_CALLBACK) { \
+ if (_error_code == ZPP_ERROR_WRONG_CALLBACK) { \
- zend_wrong_callback_error(_flags & ZEND_PARSE_PARAMS_THROW, E_WARNING, _i, _error); \
+ if (_flags & ZEND_PARSE_PARAMS_THROW) { \
+ zend_wrong_callback_exception(_i, _error); \
+ } else { \
+ zend_wrong_callback_error(_i, _error); \
+ } \
- } else if (error_code == ZPP_ERROR_WRONG_CLASS) { \
+ } else if (_error_code == ZPP_ERROR_WRONG_CLASS) { \
- zend_wrong_parameter_class_error(_flags & ZEND_PARSE_PARAMS_THROW, _i, _error, _arg); \
+ if (_flags & ZEND_PARSE_PARAMS_THROW) { \
+ zend_wrong_parameter_class_exception(_i, _error, _arg); \
+ } else { \
+ zend_wrong_parameter_class_error(_i, _error, _arg); \
+ } \
- } else if (error_code == ZPP_ERROR_WRONG_ARG) { \
+ } else if (_error_code == ZPP_ERROR_WRONG_ARG) { \
- zend_wrong_parameter_type_error(_flags & ZEND_PARSE_PARAMS_THROW, _i, _expected_type, _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); \
+ } \
} \
} \
failure; \