|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
--- /dev/null
+--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
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))) {
} 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)
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);
}
/*
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)
{
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);
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);