diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f44bc24a4b46..743df3b86292 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3806,13 +3806,6 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM) SAVE_OPLINE(); function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { - /* Deprecation can be emitted from zend_is_callable_ex(), which can - * invoke a user error handler and throw an exception. */ - if (UNEXPECTED(EG(exception))) { - FREE_OP2(); - HANDLE_EXCEPTION(); - } - ZEND_ASSERT(!error); func = fcc.function_handler; object_or_called_scope = fcc.called_scope; @@ -3834,7 +3827,10 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM) } FREE_OP2(); - if ((OP2_TYPE & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) { + /* Deprecation can be emitted from zend_is_callable_ex(), which can + * invoke a user error handler and throw an exception; so we cannot + * rely on OP2_TYPE. */ + if (UNEXPECTED(EG(exception))) { if (call_info & ZEND_CALL_CLOSURE) { zend_object_release(ZEND_CLOSURE_OBJECT(func)); } else if (call_info & ZEND_CALL_RELEASE_THIS) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5781430351dd..cab58fa51354 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -7022,13 +7022,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { - /* Deprecation can be emitted from zend_is_callable_ex(), which can - * invoke a user error handler and throw an exception. */ - if (UNEXPECTED(EG(exception))) { - - HANDLE_EXCEPTION(); - } - ZEND_ASSERT(!error); func = fcc.function_handler; object_or_called_scope = fcc.called_scope; @@ -7049,7 +7042,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS; } - if ((IS_CONST & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) { + /* Deprecation can be emitted from zend_is_callable_ex(), which can + * invoke a user error handler and throw an exception; so we cannot + * rely on IS_CONST. */ + if (UNEXPECTED(EG(exception))) { if (call_info & ZEND_CALL_CLOSURE) { zend_object_release(ZEND_CLOSURE_OBJECT(func)); } else if (call_info & ZEND_CALL_RELEASE_THIS) { @@ -9374,13 +9370,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV SAVE_OPLINE(); function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { - /* Deprecation can be emitted from zend_is_callable_ex(), which can - * invoke a user error handler and throw an exception. */ - if (UNEXPECTED(EG(exception))) { - zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - HANDLE_EXCEPTION(); - } - ZEND_ASSERT(!error); func = fcc.function_handler; object_or_called_scope = fcc.called_scope; @@ -9402,7 +9391,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV } zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - if (((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) { + /* Deprecation can be emitted from zend_is_callable_ex(), which can + * invoke a user error handler and throw an exception; so we cannot + * rely on (IS_TMP_VAR|IS_VAR). */ + if (UNEXPECTED(EG(exception))) { if (call_info & ZEND_CALL_CLOSURE) { zend_object_release(ZEND_CLOSURE_OBJECT(func)); } else if (call_info & ZEND_CALL_RELEASE_THIS) { @@ -11755,13 +11747,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H SAVE_OPLINE(); function_name = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { - /* Deprecation can be emitted from zend_is_callable_ex(), which can - * invoke a user error handler and throw an exception. */ - if (UNEXPECTED(EG(exception))) { - - HANDLE_EXCEPTION(); - } - ZEND_ASSERT(!error); func = fcc.function_handler; object_or_called_scope = fcc.called_scope; @@ -11782,7 +11767,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS; } - if ((IS_CV & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) { + /* Deprecation can be emitted from zend_is_callable_ex(), which can + * invoke a user error handler and throw an exception; so we cannot + * rely on IS_CV. */ + if (UNEXPECTED(EG(exception))) { if (call_info & ZEND_CALL_CLOSURE) { zend_object_release(ZEND_CLOSURE_OBJECT(func)); } else if (call_info & ZEND_CALL_RELEASE_THIS) {