]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.2' into PHP-7.3
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 8 Jan 2019 08:26:31 +0000 (09:26 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 8 Jan 2019 08:26:31 +0000 (09:26 +0100)
1  2 
Zend/zend_API.h

diff --cc Zend/zend_API.h
index 3c134f44ef4487fd3fccad61d6096c4bd390c87e,7e863f743a47285a5744338eaa8ab90598ff73f1..0f13bc1fbede9d266662d487402ccd15a2825f73
@@@ -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; \
  #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; \