From: Nikita Popov Date: Tue, 8 Jan 2019 08:26:31 +0000 (+0100) Subject: Merge branch 'PHP-7.2' into PHP-7.3 X-Git-Tag: php-7.3.2RC1~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7a7d32e6528f3826bc68a6f64071d40d838d2eb;p=php Merge branch 'PHP-7.2' into PHP-7.3 --- f7a7d32e6528f3826bc68a6f64071d40d838d2eb diff --cc Zend/zend_API.h index 3c134f44ef,7e863f743a..0f13bc1fbe --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@@ -740,13 -751,9 +740,13 @@@ ZEND_API ZEND_COLD void ZEND_FASTCALL z (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; \ @@@ -755,35 -762,16 +755,35 @@@ #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; \