]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorDmitry Stogov <dmitry@zend.com>
Mon, 8 Jul 2019 11:13:02 +0000 (14:13 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 8 Jul 2019 11:13:02 +0000 (14:13 +0300)
* PHP-7.4:
  Delay EG(exception) check on slow path

1  2 
Zend/zend_API.c
Zend/zend_API.h

diff --cc Zend/zend_API.c
index 1d33de34fe410a1a7e9a0d18002af1bb7cd3c97b,2e8fabfcc6b6866518858f2aeea786005c925533..45259d3f2c9a5d533da98ddd0abdbf4e56d1a290
@@@ -213,17 -254,57 +213,25 @@@ ZEND_API ZEND_COLD void ZEND_FASTCALL z
                NULL
        };
  
 -      zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
 -              class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
 -}
 -/* }}} */
 -
 -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int num, zend_expected_type expected_type, zval *arg) /* {{{ */
 -{
 -      const char *space;
 -      const char *class_name;
 -      static const char * const expected_error[] = {
 -              Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
 -              NULL
 -      };
 -
 -      if (EG(exception)) {
 -              return;
 -      }
 -      class_name = get_active_class_name(&space);
 -      zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+       if (EG(exception)) {
+               return;
+       }
+       class_name = get_active_class_name(&space);
 +      zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
                class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
  }
  /* }}} */
  
 -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg) /* {{{ */
 -{
 -      const char *space;
 -      const char *class_name;
 -
 -      if (EG(exception)) {
 -              return;
 -      }
 -      class_name = get_active_class_name(&space);
 -      zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
 -              class_name, space, get_active_function_name(), num, name, zend_zval_type_name(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_parameter_class_error(int num, const char *name, zval *arg) /* {{{ */
  {
        const char *space;
-       const char *class_name = get_active_class_name(&space);
+       const char *class_name;
  
 -      zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+       if (EG(exception)) {
+               return;
+       }
+       class_name = get_active_class_name(&space);
 +      zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
                class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg));
  }
  /* }}} */
  ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error) /* {{{ */
  {
        const char *space;
-       const char *class_name = get_active_class_name(&space);
+       const char *class_name;
  
 -      zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid callback, %s",
 -              class_name, space, get_active_function_name(), num, error);
 -      efree(error);
 -}
 -/* }}} */
 -
 -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error) /* {{{ */
 -{
 -      const char *space;
 -      const char *class_name;
 -
 -      if (EG(exception)) {
 -              return;
 -      }
 -      class_name = get_active_class_name(&space);
 -      zend_internal_type_error(1, "%s%s%s() expects parameter %d to be a valid callback, %s",
 -              class_name, space, get_active_function_name(), num, error);
 -      efree(error);
 -}
 -/* }}} */
 -
 -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error) /* {{{ */
 -{
 -      const char *space;
 -      const char *class_name = get_active_class_name(&space);
 -
 -      zend_error(E_DEPRECATED, "%s%s%s() expects parameter %d to be a valid callback, %s",
+       if (EG(exception)) {
+               return;
+       }
+       class_name = get_active_class_name(&space);
 +      zend_type_error("%s%s%s() expects parameter %d to be a valid callback, %s",
                class_name, space, get_active_function_name(), num, error);
        efree(error);
  }
diff --cc Zend/zend_API.h
index f77a8e6748ebef11d193c0dc53d6a76f145f5c45,e78ba92595c45fcb0dc0f024e3f5a45981deccc9..18c06158e142b9a36e59fb21d53a42698a42241d
@@@ -1171,13 -1184,25 +1171,13 @@@ ZEND_API ZEND_COLD void ZEND_FASTCALL z
  #define ZEND_PARSE_PARAMETERS_END_EX(failure) \
                } while (0); \
                if (UNEXPECTED(_error_code != ZPP_ERROR_OK)) { \
-                       if (!(_flags & ZEND_PARSE_PARAMS_QUIET) && !EG(exception)) { \
+                       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; \