mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fixed bug #70689 (Exception handler does not work as expected)
This commit is contained in:
parent
e85a0aba9b
commit
a8ae88162f
6 changed files with 32 additions and 13 deletions
3
NEWS
3
NEWS
|
@ -2,7 +2,8 @@ PHP NEWS
|
|||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
29 Oct 2015, PHP 7.0.0 RC 6
|
||||
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70689 (Exception handler does not work as expected). (Laruence)
|
||||
|
||||
15 Oct 2015, PHP 7.0.0 RC 5
|
||||
|
||||
|
|
22
Zend/tests/bug70689.phpt
Normal file
22
Zend/tests/bug70689.phpt
Normal file
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
Bug #70689 (Exception handler does not work as expected)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo($foo) {
|
||||
echo "Executing foo\n";
|
||||
}
|
||||
|
||||
set_error_handler(function($errno, $errstr) {
|
||||
throw new Exception($errstr);
|
||||
});
|
||||
|
||||
try {
|
||||
foo();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Missing argument 1 for foo(), called in %sbug70689.php on line %d and defined
|
|
@ -893,7 +893,7 @@ static zend_always_inline int zend_verify_missing_arg_type(zend_function *zf, ui
|
|||
return 1;
|
||||
}
|
||||
|
||||
static ZEND_COLD int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot)
|
||||
static ZEND_COLD void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot)
|
||||
{
|
||||
if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) ||
|
||||
UNEXPECTED(zend_verify_missing_arg_type(EX(func), arg_num, cache_slot))) {
|
||||
|
@ -907,9 +907,7 @@ static ZEND_COLD int zend_verify_missing_arg(zend_execute_data *execute_data, ui
|
|||
} else {
|
||||
zend_error(E_WARNING, "Missing argument %u for %s%s%s()", arg_num, class_name, space, func_name);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ZEND_COLD void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind)
|
||||
|
@ -2736,9 +2734,9 @@ ZEND_API int ZEND_FASTCALL zend_check_arg_type(zend_function *zf, uint32_t arg_n
|
|||
return zend_verify_arg_type(zf, arg_num, arg, default_value, cache_slot);
|
||||
}
|
||||
|
||||
ZEND_API int ZEND_FASTCALL zend_check_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot)
|
||||
ZEND_API void ZEND_FASTCALL zend_check_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot)
|
||||
{
|
||||
return zend_verify_missing_arg(execute_data, arg_num, cache_slot);
|
||||
zend_verify_missing_arg(execute_data, arg_num, cache_slot);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -52,7 +52,7 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c
|
|||
|
||||
ZEND_API void ZEND_FASTCALL zend_check_internal_arg_type(zend_function *zf, uint32_t arg_num, zval *arg);
|
||||
ZEND_API int ZEND_FASTCALL zend_check_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot);
|
||||
ZEND_API int ZEND_FASTCALL zend_check_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot);
|
||||
ZEND_API void ZEND_FASTCALL zend_check_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot);
|
||||
|
||||
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type)
|
||||
{
|
||||
|
|
|
@ -4714,9 +4714,8 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
|
|||
|
||||
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(!zend_verify_missing_arg(execute_data, arg_num, CACHE_ADDR(opline->op2.num)))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_verify_missing_arg(execute_data, arg_num, CACHE_ADDR(opline->op2.num));
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} 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);
|
||||
|
||||
|
|
|
@ -1204,9 +1204,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_
|
|||
|
||||
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(!zend_verify_missing_arg(execute_data, arg_num, CACHE_ADDR(opline->op2.num)))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_verify_missing_arg(execute_data, arg_num, CACHE_ADDR(opline->op2.num));
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} 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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue