]> granicus.if.org Git - php/commitdiff
Merge in master, fix merge conflicts and update patch to support exceptions everywhere
authorAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 14:50:11 +0000 (10:50 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 14:50:11 +0000 (10:50 -0400)
1  2 
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_execute.c
Zend/zend_globals.h
Zend/zend_types.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/gd/gd.c
ext/mysqli/mysqli_api.c

diff --cc Zend/zend_API.c
index 18d0c672b16ef00d67289823b8e2352ee9b87c28,c513d5db5e4f0ebea443dc687e95093b5877d7f8..02eab229f0c0cd7109a8cc1773dad15cedae9648
@@@ -153,8 -153,8 +153,9 @@@ ZEND_API void _zend_wrong_param_count(z
  {
        const char *space;
        const char *class_name = get_active_class_name(&space);
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
-       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
 -      zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
++      zend_error(error_type, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
  }
  /* }}} */
  
@@@ -238,8 -237,8 +239,9 @@@ ZEND_API void zend_wrong_paramers_count
  {
        zend_function *active_function = EG(current_execute_data)->func;
        const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
-       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
 -      zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
++      zend_error(error_type, "%s%s%s() expects %s %d parameter%s, %d given",
                class_name, \
                class_name[0] ? "::" : "", \
                active_function->common.function_name->val,
@@@ -258,8 -257,8 +260,9 @@@ ZEND_API void zend_wrong_paramer_type_e
                Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
                NULL
        };
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
-       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
 -      zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
++      zend_error(error_type, "%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));
  }
  /* }}} */
@@@ -268,8 -267,8 +271,9 @@@ ZEND_API void zend_wrong_paramer_class_
  {
        const char *space;
        const char *class_name = get_active_class_name(&space);
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
-       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
 -      zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
++      zend_error(error_type, "%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));
  }
  /* }}} */
@@@ -285,9 -284,9 +289,10 @@@ ZEND_API void zend_wrong_callback_error
  }
  /* }}} */
  
 -ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null) /* {{{ */
 +ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null, zend_bool strict) /* {{{ */
  {
        zend_class_entry *ce_base = *pce;
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
        if (check_null && Z_TYPE_P(arg) == IS_NULL) {
                *pce = NULL;
                        const char *space;
                        const char *class_name = get_active_class_name(&space);
  
-                       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
 -                      zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
++                      zend_error(error_type, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
                                class_name, space, get_active_function_name(), num,
                                ce_base->name->val, Z_STRVAL_P(arg));
                        *pce = NULL;
                const char *space;
                const char *class_name = get_active_class_name(&space);
  
-               zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
 -              zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
++              zend_error(error_type, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
                        class_name, space, get_active_function_name(), num,
                        Z_STRVAL_P(arg));
                return 0;
@@@ -540,7 -539,7 +545,7 @@@ static const char *zend_parse_arg_impl(
                                        break;
                                } else {
                                        if (is_callable_error) {
-                                               *severity = strict ? E_RECOVERABLE_ERROR : E_WARNING;
 -                                              *severity = E_WARNING;
++                                              *severity = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
                                                zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
                                                efree(is_callable_error);
                                                return "";
@@@ -575,20 -574,20 +580,21 @@@ static int zend_parse_arg(int arg_num, 
  {
        const char *expected_type = NULL;
        char *error = NULL;
-       int severity = strict ? E_RECOVERABLE_ERROR : E_WARNING;
 -      int severity = E_WARNING;
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
++      int severity;
  
 -      expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity);
 +      expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity, strict);
        if (expected_type) {
                if (!quiet && (*expected_type || error)) {
                        const char *space;
                        const char *class_name = get_active_class_name(&space);
  
                        if (error) {
--                              zend_error(severity, "%s%s%s() expects parameter %d %s",
++                              zend_error(error_type, "%s%s%s() expects parameter %d %s",
                                                class_name, space, get_active_function_name(), arg_num, error);
                                efree(error);
                        } else {
--                              zend_error(severity, "%s%s%s() expects parameter %d to be %s, %s given",
++                              zend_error(error_type, "%s%s%s() expects parameter %d to be %s, %s given",
                                                class_name, space, get_active_function_name(), arg_num, expected_type,
                                                zend_zval_type_name(arg));
                        }
@@@ -630,6 -627,6 +636,7 @@@ static int zend_parse_va_args(int num_a
        zend_bool have_varargs = 0;
        zval **varargs = NULL;
        int *n_varargs = NULL;
++      int error_type = strict ? (E_EXCEPTION | E_ERROR) : E_WARNING;
  
        for (spec_walk = type_spec; *spec_walk; spec_walk++) {
                c = *spec_walk;
                                        if (!quiet) {
                                                zend_function *active_function = EG(current_execute_data)->func;
                                                const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
-                                               zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted",
 -                                              zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted",
++                                              
++                                              zend_error(error_type, "%s%s%s(): only one varargs specifier (* or +) is permitted",
                                                                class_name,
                                                                class_name[0] ? "::" : "",
                                                                active_function->common.function_name->val);
                                if (!quiet) {
                                        zend_function *active_function = EG(current_execute_data)->func;
                                        const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
-                                       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s(): bad type specifier while parsing parameters",
 -                                      zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters",
++                                      zend_error(error_type, "%s%s%s(): bad type specifier while parsing parameters",
                                                        class_name,
                                                        class_name[0] ? "::" : "",
                                                        active_function->common.function_name->val);
                if (!quiet) {
                        zend_function *active_function = EG(current_execute_data)->func;
                        const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
-                       zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
 -                      zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
++                      zend_error(error_type, "%s%s%s() expects %s %d parameter%s, %d given",
                                        class_name,
                                        class_name[0] ? "::" : "",
                                        active_function->common.function_name->val,
        arg_count = ZEND_CALL_NUM_ARGS(EG(current_execute_data));
  
        if (num_args > arg_count) {
-               zend_error(strict ? E_RECOVERABLE_ERROR : E_WARNING, "%s(): could not obtain parameters for parsing",
 -              zend_error(E_WARNING, "%s(): could not obtain parameters for parsing",
++              zend_error(error_type, "%s(): could not obtain parameters for parsing",
                        get_active_function_name());
                return FAILURE;
        }
  }
  /* }}} */
  
 -#define RETURN_IF_ZERO_ARGS(num_args, type_spec, quiet) { \
 +#define RETURN_IF_ZERO_ARGS(num_args, type_spec, flags) { \
        int __num_args = (num_args); \
        \
 -      if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \
 +      if (0 == (type_spec)[0] && 0 != __num_args && !(flags & ZEND_PARSE_PARAMS_QUIET)) { \
                const char *__space; \
                const char * __class_name = get_active_class_name(&__space); \
-               zend_error((flags & ZEND_PARSE_PARAMS_STRICT) ? E_RECOVERABLE_ERROR : E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \
 -              zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \
++              zend_error((flags & ZEND_PARSE_PARAMS_STRICT) ? (E_EXCEPTION | E_ERROR) : E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \
                        __class_name, __space, \
                        get_active_function_name(), __num_args); \
                return FAILURE; \
diff --cc Zend/zend_API.h
Simple merge
index 4e5914d0c5ad345112890276d2b9d1846aab984a,962bb14b42a0651c258b1fa2ef043b8592f76139..bfbb552f3f5cf16d2a37bf5c2d5d1eee22695f6c
@@@ -2651,9 -2653,8 +2720,9 @@@ void zend_compile_call_common(znode *re
                opline->op1.num = zend_vm_calc_used_stack(arg_count, fbc);
        }
  
-       call_flags = ((opline->opcode == ZEND_NEW) ? ZEND_CALL_CTOR : 0)
 -      call_flags = (opline->opcode == ZEND_NEW ? ZEND_CALL_CTOR : 0);
++      call_flags = (opline->opcode == ZEND_NEW ? ZEND_CALL_CTOR : 0)
 +              | (CG(declarables).strict_types ? ZEND_CALL_STRICT_TYPEHINTS : 0);
-       opline = zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL);
+       opline = zend_emit_op(result, zend_get_call_op(opline->opcode, fbc), NULL, NULL);
        opline->op1.num = call_flags;
  
        zend_do_extended_fcall_end();
index e6fefd46ba707a2cca08c92032d0b32735c2656e,45441e2108dcab05d60608ca0029731200f71a7f..3e1b10870cc1a87174d15d5a57c9e448e74caa03
@@@ -465,6 -458,6 +459,7 @@@ struct _zend_execute_data 
  #define EX_CALL_INFO()                        ZEND_CALL_INFO(execute_data)
  #define EX_CALL_KIND()                        ZEND_CALL_KIND(execute_data)
  #define EX_NUM_ARGS()                 ZEND_CALL_NUM_ARGS(execute_data)
++#define EX_USES_STRICT_TYPES()        ((EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0)
  
  #define EX_VAR(n)                             ZEND_CALL_VAR(execute_data, n)
  #define EX_VAR_NUM(n)                 ZEND_CALL_VAR_NUM(execute_data, n)
index 1fcc95d33039fef7012e1ca6c02a26e10c430b0b,1692baa9991ba4a8dbc34e121a9c593b70e1945a..4321c0f33090448950ac9e13ce7e3d6c7e3d15b8
@@@ -682,29 -674,22 +721,29 @@@ static void zend_verify_internal_arg_ty
                        }
                } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
                        need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce);
-                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
+                       zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
                }
        } else if (cur_arg_info->type_hint) {
 +              ZVAL_DEREF(arg);
                if (cur_arg_info->type_hint == IS_ARRAY) {
 -                      ZVAL_DEREF(arg);
                        if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
-                               zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
+                               zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
                        }
                } else if (cur_arg_info->type_hint == IS_CALLABLE) {
                        if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
-                               zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
+                               zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
                        }
 -#if ZEND_DEBUG
 -              } else {
 -                      zend_error(E_ERROR, "Unknown typehint");
 -#endif
 +              } else if (UNEXPECTED(!ZEND_SAME_FAKE_TYPE(cur_arg_info->type_hint, Z_TYPE_P(arg)))) {
 +                      if (Z_TYPE_P(arg) == IS_NULL) {
 +                              if (!cur_arg_info->allow_null) {
 +failure:
-                                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
++                                      zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
 +                              }
 +                              return;
 +                      }
 +                      if (!zend_verify_scalar_type_hint(cur_arg_info->type_hint, arg, strict)) {
 +                              goto failure;
 +                      }
                }
        }
  }
@@@ -734,29 -719,22 +773,29 @@@ static void zend_verify_arg_type(zend_f
                        }
                } else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
                        need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
-                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
+                       zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
                }
        } else if (cur_arg_info->type_hint) {
 +              ZVAL_DEREF(arg);
                if (cur_arg_info->type_hint == IS_ARRAY) {
 -                      ZVAL_DEREF(arg);
                        if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
-                               zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
+                               zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
                        }
                } else if (cur_arg_info->type_hint == IS_CALLABLE) {
                        if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
-                               zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
+                               zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
                        }
 -#if ZEND_DEBUG
 -              } else {
 -                      zend_error(E_ERROR, "Unknown typehint");
 -#endif
 +              } else if (UNEXPECTED(!ZEND_SAME_FAKE_TYPE(cur_arg_info->type_hint,  Z_TYPE_P(arg)))) {
 +                      if (Z_TYPE_P(arg) == IS_NULL) {
 +                              if (!cur_arg_info->allow_null) {
 +failure:
-                                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
++                                      zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
 +                              }
 +                              return;
 +                      }
 +                      if (!zend_verify_scalar_type_hint(cur_arg_info->type_hint, arg, strict)) {
 +                              goto failure;
 +                      }
                }
        }
  }
@@@ -783,11 -761,13 +822,11 @@@ static inline int zend_verify_missing_a
                return 0;
        } else if (cur_arg_info->type_hint) {
                if (cur_arg_info->type_hint == IS_ARRAY) {
-                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "", NULL);
+                       zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type array", "", "none", "", NULL);
                } else if (cur_arg_info->type_hint == IS_CALLABLE) {
-                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "", NULL);
+                       zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be callable", "", "none", "", NULL);
 -#if ZEND_DEBUG
                } else {
-                       zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), "none", "", NULL);
 -                      zend_error(E_ERROR, "Unknown typehint");
 -#endif
++                      zend_verify_arg_error(E_EXCEPTION | E_ERROR, zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), "none", "", NULL);
                }
                return 0;
        }
@@@ -831,7 -811,7 +870,7 @@@ ZEND_API void zend_verify_return_error(
  }
  
  #if ZEND_DEBUG
--static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
++static int zend_verify_internal_return_type(zend_function *zf, zval *ret, zend_bool strict)
  {
        zend_arg_info *ret_info = zf->common.arg_info - 1;
        char *need_msg;
                                zend_verify_return_error(E_CORE_ERROR, zf, "be callable", "", zend_zval_type_name(ret), "");
                                return 0;
                        }
--#if ZEND_DEBUG
--              } else {
--                      zend_error(E_CORE_ERROR, "Unknown typehint");
--                      return 0;
--#endif
++              } else if (UNEXPECTED(!ZEND_SAME_FAKE_TYPE(ret_info->type_hint, Z_TYPE_P(ret)))) {
++                      if (Z_TYPE_P(ret) == IS_NULL) {
++                              if (!ret_info->allow_null) {
++failure:
++                                      zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), zend_zval_type_name(ret), "");
++                              }
++                              return 0;
++                      }
++                      if (!zend_verify_scalar_type_hint(ret_info->type_hint, ret, strict)) {
++                              goto failure;
++                      }
                }
        }
        return 1;
@@@ -898,19 -878,12 +943,19 @@@ static void zend_verify_return_type(zen
                        }
                } else if (ret_info->type_hint == IS_CALLABLE) {
                        if (!zend_is_callable(ret, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(ret) != IS_NULL || !ret_info->allow_null)) {
-                               zend_verify_return_error(E_RECOVERABLE_ERROR, zf, "be callable", "", zend_zval_type_name(ret), "");
+                               zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be callable", "", zend_zval_type_name(ret), "");
                        }
 -#if ZEND_DEBUG
 -              } else {
 -                      zend_error(E_ERROR, "Unknown typehint");
 -#endif
 +              } else if (UNEXPECTED(!ZEND_SAME_FAKE_TYPE(ret_info->type_hint, Z_TYPE_P(ret)))) {
 +                      if (Z_TYPE_P(ret) == IS_NULL) {
 +                              if (!ret_info->allow_null) {
 +failure:
-                                       zend_verify_return_error(E_RECOVERABLE_ERROR, zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), zend_zval_type_name(ret), "");
++                                      zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), zend_zval_type_name(ret), "");
 +                              }
 +                              return;
 +                      }
 +                      if (!zend_verify_scalar_type_hint(ret_info->type_hint, ret, strict)) {
 +                              goto failure;
 +                      }
                }
        }
  }
@@@ -929,11 -902,13 +974,11 @@@ static inline int zend_verify_missing_r
                return 0;
        } else if (ret_info->type_hint) {
                if (ret_info->type_hint == IS_ARRAY) {
-                       zend_verify_return_error(E_RECOVERABLE_ERROR, zf, "be of the type array", "", "none", "");
+                       zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be of the type array", "", "none", "");
                } else if (ret_info->type_hint == IS_CALLABLE) {
-                       zend_verify_return_error(E_RECOVERABLE_ERROR, zf, "be callable", "", "none", "");
+                       zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be callable", "", "none", "");
 -#if ZEND_DEBUG
                } else {
-                       zend_verify_return_error(E_RECOVERABLE_ERROR, zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), "none", "");
 -                      zend_error(E_ERROR, "Unknown typehint");
 -#endif
++                      zend_verify_return_error(E_EXCEPTION | E_ERROR, zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), "none", "");
                }
                return 0;
        }
Simple merge
Simple merge
index 3014e48bd4cdddca1972ceec236cb23647b9191f,ab2c7b89a37818aab2df1d758899a54e5ae388ac..da8052c97bf7176b93c32ef91de4b06ebf4c5b5c
@@@ -2726,68 -3140,245 +3140,245 @@@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CAL
                object = NULL;
        }
  
-       EX(call) = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
-               func, opline->extended_value, called_scope, object, EX(call));
+       EX(call) = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
+               func, opline->extended_value, called_scope, object, EX(call));
+       FREE_OP2();
+       CHECK_EXCEPTION();
+       ZEND_VM_NEXT_OPCODE();
+ }
+ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
+ {
+       USE_OPLINE
+       zval *func_name;
+       zval *func;
+       zend_function *fbc;
+       func_name = EX_CONSTANT(opline->op2) + 1;
+       if (CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) {
+               fbc = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
+       } else if ((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL) {
+               func_name++;
+               if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
+                       SAVE_OPLINE();
+                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                       HANDLE_EXCEPTION();
+               } else {
+                       fbc = Z_FUNC_P(func);
+                       CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), fbc);
+               }
+       } else {
+               fbc = Z_FUNC_P(func);
+               CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), fbc);
+       }
+       EX(call) = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
+               fbc, opline->extended_value, NULL, NULL, EX(call));
+       ZEND_VM_NEXT_OPCODE();
+ }
+ ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST)
+ {
+       USE_OPLINE
+       zend_free_op free_op2;
+       zval *fname = GET_OP2_ZVAL_PTR(BP_VAR_R);
+       zval *func;
+       zend_function *fbc;
+       if (CACHED_PTR(Z_CACHE_SLOT_P(fname))) {
+               fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
+       } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
+           SAVE_OPLINE();
+               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
+               HANDLE_EXCEPTION();
+       } else {
+               fbc = Z_FUNC_P(func);
+               CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
+       }
+       EX(call) = zend_vm_stack_push_call_frame_ex(
+               opline->op1.num, ZEND_CALL_NESTED_FUNCTION,
+               fbc, opline->extended_value, NULL, NULL, EX(call));
+       FREE_OP2();
+       ZEND_VM_NEXT_OPCODE();
+ }
+ ZEND_VM_HANDLER(129, ZEND_DO_ICALL, ANY, ANY)
+ {
+       USE_OPLINE
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       call->called_scope = EX(called_scope);
+       Z_OBJ(call->This) = Z_OBJ(EX(This));
+       call->prev_execute_data = execute_data;
+       EG(current_execute_data) = call;
+       ret = EX_VAR(opline->result.var);
+       ZVAL_NULL(ret);
+       Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
+       fbc->internal_function.handler(call, ret);
+       ZEND_ASSERT(
+               !call->func ||
+               !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
 -              zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++              zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
+       EG(current_execute_data) = call->prev_execute_data;
+       zend_vm_stack_free_args(call);
+       zend_vm_stack_free_call_frame(call);
+       if (!RETURN_VALUE_USED(opline)) {
+               zval_ptr_dtor(EX_VAR(opline->result.var));
+       }
+       if (UNEXPECTED(EG(exception) != NULL)) {
+               zend_throw_exception_internal(NULL);
+               if (RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+               HANDLE_EXCEPTION();
+       }
+       ZEND_VM_INTERRUPT_CHECK();
+       ZEND_VM_NEXT_OPCODE();
+ }
+ ZEND_VM_HANDLER(130, ZEND_DO_UCALL, ANY, ANY)
+ {
+       USE_OPLINE
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       EG(scope) = NULL;
+       ret = NULL;
+       call->symbol_table = NULL;
+       if (RETURN_VALUE_USED(opline)) {
+               ret = EX_VAR(opline->result.var);
+               ZVAL_NULL(ret);
+               Z_VAR_FLAGS_P(ret) = 0;
+       }
+       call->prev_execute_data = execute_data;
+       i_init_func_execute_data(call, &fbc->op_array, ret, 0);
  
-       FREE_OP2();
-       CHECK_EXCEPTION();
-       ZEND_VM_NEXT_OPCODE();
+       ZEND_VM_ENTER();
  }
  
- ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
+ ZEND_VM_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY)
  {
        USE_OPLINE
-       zval *func_name;
-       zval *func;
-       zend_function *fbc;
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
  
-       func_name = EX_CONSTANT(opline->op2) + 1;
-       if (CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) {
-               fbc = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
-       } else if ((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL) {
-               func_name++;
-               if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
-                       SAVE_OPLINE();
-                       zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
+               EG(scope) = NULL;
+               if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
+                       if (RETURN_VALUE_USED(opline)) {
+                               zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var));
+                       } else {
+                               zend_vm_stack_free_args(call);
+                       }
+                       zend_vm_stack_free_call_frame(call);
                } else {
-                       fbc = Z_FUNC_P(func);
-                       CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), fbc);
+                       ret = NULL;
+                       call->symbol_table = NULL;
+                       if (RETURN_VALUE_USED(opline)) {
+                               ret = EX_VAR(opline->result.var);
+                               ZVAL_NULL(ret);
+                               Z_VAR_FLAGS_P(ret) = 0;
+                       }
+                       call->prev_execute_data = execute_data;
+                       i_init_func_execute_data(call, &fbc->op_array, ret, 0);
+                       ZEND_VM_ENTER();
                }
+               EG(scope) = EX(func)->op_array.scope;
        } else {
-               fbc = Z_FUNC_P(func);
-               CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), fbc);
-       }
+               ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
  
-       EX(call) = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
-               fbc, opline->extended_value, NULL, NULL, EX(call));
+               if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+                       zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
+                               fbc->common.scope ? fbc->common.scope->name->val : "",
+                               fbc->common.scope ? "::" : "",
+                               fbc->common.function_name->val);
+                       if (UNEXPECTED(EG(exception) != NULL)) {
+                               HANDLE_EXCEPTION();
+                       }
+               }
  
-       ZEND_VM_NEXT_OPCODE();
- }
+               call->called_scope = EX(called_scope);
+               Z_OBJ(call->This) = Z_OBJ(EX(This));
  
- ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST)
- {
-       USE_OPLINE
-       zend_free_op free_op2;
-       zval *fname = GET_OP2_ZVAL_PTR(BP_VAR_R);
-       zval *func;
-       zend_function *fbc;
+               call->prev_execute_data = execute_data;
+               EG(current_execute_data) = call;
  
-       if (CACHED_PTR(Z_CACHE_SLOT_P(fname))) {
-               fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
-       } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
-           SAVE_OPLINE();
-               zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
-       } else {
-               fbc = Z_FUNC_P(func);
-               CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
-       }
+               if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+                       uint32_t i;
+                       uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
+                       zval *p = ZEND_CALL_ARG(call, 1);
  
-       EX(call) = zend_vm_stack_push_call_frame_ex(
-               opline->op1.num, ZEND_CALL_NESTED_FUNCTION,
-               fbc, opline->extended_value, NULL, NULL, EX(call));
+                       for (i = 0; i < num_args; ++i) {
 -                              zend_verify_internal_arg_type(fbc, i + 1, p);
++                              zend_verify_internal_arg_type(fbc, i + 1, p, EX_USES_STRICT_TYPES());
+                               p++;
+                       }
+                       if (UNEXPECTED(EG(exception) != NULL)) {
+                               EG(current_execute_data) = call->prev_execute_data;
+                               zend_vm_stack_free_args(call);
+                               zend_vm_stack_free_call_frame(call);
+                               zend_throw_exception_internal(NULL);
+                               HANDLE_EXCEPTION();
+                       }
+               }
  
-       FREE_OP2();
+               ret = EX_VAR(opline->result.var);
+               ZVAL_NULL(ret);
+               Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
+               fbc->internal_function.handler(call, ret);
+               ZEND_ASSERT(
+                       !call->func ||
+                       !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
 -                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
+               EG(current_execute_data) = call->prev_execute_data;
+               zend_vm_stack_free_args(call);
+               zend_vm_stack_free_call_frame(call);
+               if (!RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+       }
  
+       if (UNEXPECTED(EG(exception) != NULL)) {
+               zend_throw_exception_internal(NULL);
+               if (RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+               HANDLE_EXCEPTION();
+       }
+       ZEND_VM_INTERRUPT_CHECK();
        ZEND_VM_NEXT_OPCODE();
  }
  
@@@ -2876,21 -3465,21 +3467,21 @@@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY
                        zval *p = ZEND_CALL_ARG(call, 1);
  
                        for (i = 0; i < num_args; ++i) {
-                               zend_verify_internal_arg_type(fbc, i + 1, p, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
-                               p++;
-                       }
-                       if (UNEXPECTED(EG(exception) != NULL)) {
-                               EG(current_execute_data) = call->prev_execute_data;
-                               zend_vm_stack_free_args(call);
-                               zend_vm_stack_free_call_frame(call);
-                               if (RETURN_VALUE_USED(opline)) {
-                                       ZVAL_UNDEF(EX_VAR(opline->result.var));
-                               }
-                               if (UNEXPECTED(should_change_scope)) {
-                                       ZEND_VM_C_GOTO(fcall_end_change_scope);
-                               } else {
-                                       ZEND_VM_C_GOTO(fcall_end);
 -                              zend_verify_internal_arg_type(fbc, i + 1, p);
++                              zend_verify_internal_arg_type(fbc, i + 1, p, EX_USES_STRICT_TYPES());
+                               if (UNEXPECTED(EG(exception) != NULL)) {
+                                       EG(current_execute_data) = call->prev_execute_data;
+                                       zend_vm_stack_free_args(call);
+                                       zend_vm_stack_free_call_frame(call);
+                                       if (RETURN_VALUE_USED(opline)) {
+                                               ZVAL_UNDEF(EX_VAR(opline->result.var));
+                                       }
+                                       if (UNEXPECTED(should_change_scope)) {
+                                               ZEND_VM_C_GOTO(fcall_end_change_scope);
+                                       } else {
+                                               ZEND_VM_C_GOTO(fcall_end);
+                                       }
                                }
+                               p++;
                        }
                }
  
                ZEND_ASSERT(
                        !call->func ||
                        !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
--                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
  
                EG(current_execute_data) = call->prev_execute_data;
                zend_vm_stack_free_args(call);
@@@ -3731,7 -4368,7 +4374,7 @@@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY
        } else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
                zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
  
-               zend_verify_arg_type(EX(func), arg_num, param, NULL, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
 -              zend_verify_arg_type(EX(func), arg_num, param, NULL);
++              zend_verify_arg_type(EX(func), arg_num, param, NULL, EX_USES_STRICT_TYPES());
                CHECK_EXCEPTION();
        }
  
@@@ -3759,7 -4396,7 +4402,7 @@@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY
        }
  
        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
-               zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2), (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
 -              zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2));
++              zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2), EX_USES_STRICT_TYPES());
        }
  
        CHECK_EXCEPTION();
@@@ -3785,8 -4422,8 +4428,8 @@@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC
                ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
                        param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
                        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 -                              do {
 -                                      zend_verify_arg_type(EX(func), arg_num, param, NULL);
 +                              do {                    
-                                       zend_verify_arg_type(EX(func), arg_num, param, NULL, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
++                                      zend_verify_arg_type(EX(func), arg_num, param, NULL, EX_USES_STRICT_TYPES());
                                        if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
                                        ZEND_HASH_FILL_ADD(param);
                                        param++;
index cb0ad9eeb25142e449af64b6977facecc3a6e54d,e5547f3e1eaf9910bea3e3114e5afb8615cc1da4..c9b09c7bc40480a59c65fb9c8eb1825b2b0c96ac
@@@ -486,7 -538,182 +538,182 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
        ZEND_VM_CONTINUE();
  }
  
- static int ZEND_FASTCALL  ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+ {
+       USE_OPLINE
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       call->called_scope = EX(called_scope);
+       Z_OBJ(call->This) = Z_OBJ(EX(This));
+       call->prev_execute_data = execute_data;
+       EG(current_execute_data) = call;
+       ret = EX_VAR(opline->result.var);
+       ZVAL_NULL(ret);
+       Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
+       fbc->internal_function.handler(call, ret);
+       ZEND_ASSERT(
+               !call->func ||
+               !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
 -              zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++              zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
+       EG(current_execute_data) = call->prev_execute_data;
+       zend_vm_stack_free_args(call);
+       zend_vm_stack_free_call_frame(call);
+       if (!RETURN_VALUE_USED(opline)) {
+               zval_ptr_dtor(EX_VAR(opline->result.var));
+       }
+       if (UNEXPECTED(EG(exception) != NULL)) {
+               zend_throw_exception_internal(NULL);
+               if (RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+               HANDLE_EXCEPTION();
+       }
+       ZEND_VM_INTERRUPT_CHECK();
+       ZEND_VM_NEXT_OPCODE();
+ }
+ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_UCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+ {
+       USE_OPLINE
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       EG(scope) = NULL;
+       ret = NULL;
+       call->symbol_table = NULL;
+       if (RETURN_VALUE_USED(opline)) {
+               ret = EX_VAR(opline->result.var);
+               ZVAL_NULL(ret);
+               Z_VAR_FLAGS_P(ret) = 0;
+       }
+       call->prev_execute_data = execute_data;
+       i_init_func_execute_data(call, &fbc->op_array, ret, 0);
+       ZEND_VM_ENTER();
+ }
+ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+ {
+       USE_OPLINE
+       zend_execute_data *call = EX(call);
+       zend_function *fbc = call->func;
+       zval *ret;
+       SAVE_OPLINE();
+       EX(call) = call->prev_execute_data;
+       if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
+               EG(scope) = NULL;
+               if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
+                       if (RETURN_VALUE_USED(opline)) {
+                               zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var));
+                       } else {
+                               zend_vm_stack_free_args(call);
+                       }
+                       zend_vm_stack_free_call_frame(call);
+               } else {
+                       ret = NULL;
+                       call->symbol_table = NULL;
+                       if (RETURN_VALUE_USED(opline)) {
+                               ret = EX_VAR(opline->result.var);
+                               ZVAL_NULL(ret);
+                               Z_VAR_FLAGS_P(ret) = 0;
+                       }
+                       call->prev_execute_data = execute_data;
+                       i_init_func_execute_data(call, &fbc->op_array, ret, 0);
+                       ZEND_VM_ENTER();
+               }
+               EG(scope) = EX(func)->op_array.scope;
+       } else {
+               ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+               if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+                       zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
+                               fbc->common.scope ? fbc->common.scope->name->val : "",
+                               fbc->common.scope ? "::" : "",
+                               fbc->common.function_name->val);
+                       if (UNEXPECTED(EG(exception) != NULL)) {
+                               HANDLE_EXCEPTION();
+                       }
+               }
+               call->called_scope = EX(called_scope);
+               Z_OBJ(call->This) = Z_OBJ(EX(This));
+               call->prev_execute_data = execute_data;
+               EG(current_execute_data) = call;
+               if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+                       uint32_t i;
+                       uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
+                       zval *p = ZEND_CALL_ARG(call, 1);
+                       for (i = 0; i < num_args; ++i) {
 -                              zend_verify_internal_arg_type(fbc, i + 1, p);
++                              zend_verify_internal_arg_type(fbc, i + 1, p, EX_USES_STRICT_TYPES());
+                               p++;
+                       }
+                       if (UNEXPECTED(EG(exception) != NULL)) {
+                               EG(current_execute_data) = call->prev_execute_data;
+                               zend_vm_stack_free_args(call);
+                               zend_vm_stack_free_call_frame(call);
+                               zend_throw_exception_internal(NULL);
+                               HANDLE_EXCEPTION();
+                       }
+               }
+               ret = EX_VAR(opline->result.var);
+               ZVAL_NULL(ret);
+               Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
+               fbc->internal_function.handler(call, ret);
+               ZEND_ASSERT(
+                       !call->func ||
+                       !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
 -                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
+               EG(current_execute_data) = call->prev_execute_data;
+               zend_vm_stack_free_args(call);
+               zend_vm_stack_free_call_frame(call);
+               if (!RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+       }
+       if (UNEXPECTED(EG(exception) != NULL)) {
+               zend_throw_exception_internal(NULL);
+               if (RETURN_VALUE_USED(opline)) {
+                       zval_ptr_dtor(EX_VAR(opline->result.var));
+               }
+               HANDLE_EXCEPTION();
+       }
+       ZEND_VM_INTERRUPT_CHECK();
+       ZEND_VM_NEXT_OPCODE();
+ }
+ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
        USE_OPLINE
        zend_execute_data *call = EX(call);
                        zval *p = ZEND_CALL_ARG(call, 1);
  
                        for (i = 0; i < num_args; ++i) {
-                               zend_verify_internal_arg_type(fbc, i + 1, p, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
-                               p++;
-                       }
-                       if (UNEXPECTED(EG(exception) != NULL)) {
-                               EG(current_execute_data) = call->prev_execute_data;
-                               zend_vm_stack_free_args(call);
-                               zend_vm_stack_free_call_frame(call);
-                               if (RETURN_VALUE_USED(opline)) {
-                                       ZVAL_UNDEF(EX_VAR(opline->result.var));
-                               }
-                               if (UNEXPECTED(should_change_scope)) {
-                                       goto fcall_end_change_scope;
-                               } else {
-                                       goto fcall_end;
 -                              zend_verify_internal_arg_type(fbc, i + 1, p);
++                              zend_verify_internal_arg_type(fbc, i + 1, p, EX_USES_STRICT_TYPES());
+                               if (UNEXPECTED(EG(exception) != NULL)) {
+                                       EG(current_execute_data) = call->prev_execute_data;
+                                       zend_vm_stack_free_args(call);
+                                       zend_vm_stack_free_call_frame(call);
+                                       if (RETURN_VALUE_USED(opline)) {
+                                               ZVAL_UNDEF(EX_VAR(opline->result.var));
+                                       }
+                                       if (UNEXPECTED(should_change_scope)) {
+                                               goto fcall_end_change_scope;
+                                       } else {
+                                               goto fcall_end;
+                                       }
                                }
+                               p++;
                        }
                }
  
                ZEND_ASSERT(
                        !call->func ||
                        !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
--                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var)));
++                      zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var), EX_USES_STRICT_TYPES()));
  
                EG(current_execute_data) = call->prev_execute_data;
                zend_vm_stack_free_args(call);
@@@ -991,7 -1218,7 +1220,7 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
        } else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
                zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
  
-               zend_verify_arg_type(EX(func), arg_num, param, NULL, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
 -              zend_verify_arg_type(EX(func), arg_num, param, NULL);
++              zend_verify_arg_type(EX(func), arg_num, param, NULL, EX_USES_STRICT_TYPES());
                CHECK_EXCEPTION();
        }
  
@@@ -1018,7 -1245,7 +1247,7 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
                        param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
                        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
                                do {
-                                       zend_verify_arg_type(EX(func), arg_num, param, NULL, (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
 -                                      zend_verify_arg_type(EX(func), arg_num, param, NULL);
++                                      zend_verify_arg_type(EX(func), arg_num, param, NULL, EX_USES_STRICT_TYPES());
                                        if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
                                        ZEND_HASH_FILL_ADD(param);
                                        param++;
@@@ -1776,7 -2076,7 +2078,7 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
        }
  
        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
-               zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2), (EX_CALL_INFO() & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0);
 -              zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2));
++              zend_verify_arg_type(EX(func), arg_num, param, EX_CONSTANT(opline->op2), EX_USES_STRICT_TYPES());
        }
  
        CHECK_EXCEPTION();
diff --cc ext/gd/gd.c
Simple merge
Simple merge