Fixed bug #63914 (zend_do_fcall_common_helper_SPEC does not handle exceptions properly). (Jeff Welch)

This commit is contained in:
Dmitry Stogov 2013-03-25 15:07:27 +04:00
parent 66682f5abe
commit c4686b4de9
3 changed files with 32 additions and 24 deletions

2
NEWS
View File

@ -5,6 +5,8 @@ PHP NEWS
- Core
. Fixed bug #64370 (microtime(true) less than $_SERVER['REQUEST_TIME_FLOAT']).
(Anatol)
. Fixed bug #63914 (zend_do_fcall_common_helper_SPEC does not handle
exceptions properly). (Jeff Welch)
. Fixed bug #62343 (Show class_alias In get_declared_classes()) (Dmitry)
- PCRE:

View File

@ -2301,10 +2301,6 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC);
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
if (EX(function_state).function->common.arg_info) {
zend_uint i=0;
zval **p = (zval**)EX(function_state).arguments;
@ -2315,15 +2311,22 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
arg_count--;
}
}
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
if (EXPECTED(EG(exception) == NULL)) {
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
}
}
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
EX(original_return_value) = EG(return_value_ptr_ptr);

View File

@ -301,10 +301,6 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC);
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
if (EX(function_state).function->common.arg_info) {
zend_uint i=0;
zval **p = (zval**)EX(function_state).arguments;
@ -315,15 +311,22 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
arg_count--;
}
}
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(execute_data, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
if (EXPECTED(EG(exception) == NULL)) {
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(execute_data, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
}
}
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
EX(original_return_value) = EG(return_value_ptr_ptr);