mirror of
https://github.com/php/php-src.git
synced 2024-12-19 06:50:17 +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));
|
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)
|
static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
|
||||||
{
|
{
|
||||||
zend_uchar c;
|
zend_uchar c;
|
||||||
|
@ -1025,16 +1025,6 @@ ZEND_VM_COLD_HELPER(zend_this_not_in_object_context_helper, ANY, ANY)
|
|||||||
HANDLE_EXCEPTION();
|
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)
|
ZEND_VM_COLD_HELPER(zend_undefined_function_helper, ANY, ANY)
|
||||||
{
|
{
|
||||||
USE_OPLINE
|
USE_OPLINE
|
||||||
@ -4163,12 +4153,15 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
|
|||||||
EX(call) = call->prev_execute_data;
|
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|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 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 {
|
} else {
|
||||||
zend_deprecated_function(fbc);
|
zend_deprecated_function(fbc);
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
UNDEF_RESULT();
|
ZEND_VM_C_GOTO(fcall_except);
|
||||||
HANDLE_EXCEPTION();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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)) {
|
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||||
OBJ_RELEASE(Z_OBJ(call->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();
|
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)
|
static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_undefined_function_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
{
|
{
|
||||||
USE_OPLINE
|
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;
|
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|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 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 {
|
} else {
|
||||||
zend_deprecated_function(fbc);
|
zend_deprecated_function(fbc);
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
UNDEF_RESULT();
|
goto fcall_except;
|
||||||
HANDLE_EXCEPTION();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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)) {
|
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||||
OBJ_RELEASE(Z_OBJ(call->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;
|
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|ZEND_ACC_DEPRECATED)) != 0)) {
|
||||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 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 {
|
} else {
|
||||||
zend_deprecated_function(fbc);
|
zend_deprecated_function(fbc);
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
UNDEF_RESULT();
|
goto fcall_except;
|
||||||
HANDLE_EXCEPTION();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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)) {
|
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
|
||||||
OBJ_RELEASE(Z_OBJ(call->This));
|
OBJ_RELEASE(Z_OBJ(call->This));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user