mirror of
https://github.com/php/php-src.git
synced 2024-12-18 22:41:20 +08:00
Merge branch 'PHP-7.4'
This commit is contained in:
commit
b02f425b6c
18
Zend/tests/call_to_abstract_method_args.phpt
Normal file
18
Zend/tests/call_to_abstract_method_args.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Check that arguments are freed when a call to an abstract method throws
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
abstract class Test {
|
||||
abstract static function method();
|
||||
}
|
||||
|
||||
try {
|
||||
Test::method(new stdClass);
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Cannot call abstract method Test::method()
|
@ -1553,6 +1553,12 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(c
|
||||
ZSTR_VAL(fbc->common.function_name));
|
||||
}
|
||||
|
||||
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_abstract_method(const zend_function *fbc)
|
||||
{
|
||||
zend_throw_error(NULL, "Cannot call abstract method %s::%s()",
|
||||
ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
|
||||
}
|
||||
|
||||
static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zend_uchar c;
|
||||
|
@ -1025,16 +1025,6 @@ ZEND_VM_COLD_HELPER(zend_this_not_in_object_context_helper, ANY, ANY)
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_COLD_HELPER(zend_abstract_method_helper, ANY, ANY, zend_function *func)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_COLD_HELPER(zend_undefined_function_helper, ANY, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
@ -4163,12 +4153,15 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
|
||||
EX(call) = call->prev_execute_data;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_abstract_method_helper, func, fbc);
|
||||
zend_abstract_method(fbc);
|
||||
ZEND_VM_C_LABEL(fcall_except):
|
||||
UNDEF_RESULT();
|
||||
zend_vm_stack_free_args(call);
|
||||
ZEND_VM_C_GOTO(fcall_end);
|
||||
} else {
|
||||
zend_deprecated_function(fbc);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
ZEND_VM_C_GOTO(fcall_except);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4237,6 +4230,7 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_VM_C_LABEL(fcall_end):
|
||||
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||
OBJ_RELEASE(Z_OBJ(call->This));
|
||||
}
|
||||
|
@ -781,16 +781,6 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_th
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_abstract_method_helper_SPEC(zend_function *func ZEND_OPCODE_HANDLER_ARGS_DC)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_undefined_function_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
@ -1575,12 +1565,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
|
||||
EX(call) = call->prev_execute_data;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
|
||||
ZEND_VM_TAIL_CALL(zend_abstract_method_helper_SPEC(fbc ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
|
||||
zend_abstract_method(fbc);
|
||||
fcall_except:
|
||||
UNDEF_RESULT();
|
||||
zend_vm_stack_free_args(call);
|
||||
goto fcall_end;
|
||||
} else {
|
||||
zend_deprecated_function(fbc);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
goto fcall_except;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1649,6 +1642,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
|
||||
}
|
||||
}
|
||||
|
||||
fcall_end:
|
||||
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||
OBJ_RELEASE(Z_OBJ(call->This));
|
||||
}
|
||||
@ -1674,12 +1668,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
|
||||
EX(call) = call->prev_execute_data;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
|
||||
ZEND_VM_TAIL_CALL(zend_abstract_method_helper_SPEC(fbc ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
|
||||
zend_abstract_method(fbc);
|
||||
fcall_except:
|
||||
UNDEF_RESULT();
|
||||
zend_vm_stack_free_args(call);
|
||||
goto fcall_end;
|
||||
} else {
|
||||
zend_deprecated_function(fbc);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
goto fcall_except;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1748,6 +1745,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
|
||||
}
|
||||
}
|
||||
|
||||
fcall_end:
|
||||
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||
OBJ_RELEASE(Z_OBJ(call->This));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user