summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index be8b5afe09..a4bf8f62fd 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -187,8 +187,6 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(scope) = NULL;
- ZVAL_OBJ(&EG(This), NULL);
-
EG(active) = 1;
}
/* }}} */
@@ -660,7 +658,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
- zend_object *orig_object;
zend_class_entry *orig_scope;
zval tmp;
@@ -682,7 +679,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
break;
}
- orig_object = Z_OBJ(EG(This));
orig_scope = EG(scope);
/* Initialize execute_data */
@@ -832,10 +828,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(scope) = calling_scope;
if (!fci->object ||
(func->common.fn_flags & ZEND_ACC_STATIC)) {
- Z_OBJ(EG(This)) = call->object = NULL;
+ Z_OBJ(call->This) = NULL;
+ Z_TYPE_INFO(call->This) = IS_UNDEF;
} else {
- Z_OBJ(EG(This)) = fci->object;
- Z_ADDREF(EG(This));
+ ZVAL_OBJ(&call->This, fci->object);
+ GC_REFCOUNT(fci->object)++;
}
if (func->type == ZEND_USER_FUNCTION) {
@@ -858,7 +855,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(current_execute_data) = call;
if (EXPECTED(zend_execute_internal == NULL)) {
/* saves one function call if zend_execute_internal is not used */
- func->internal_function.handler(fci->param_count, fci->retval TSRMLS_CC);
+ func->internal_function.handler(call, fci->retval TSRMLS_CC);
} else {
zend_execute_internal(call, fci->retval TSRMLS_CC);
}
@@ -888,7 +885,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (fci->object) {
call->prev_execute_data = EG(current_execute_data);
EG(current_execute_data) = call;
- fci->object->handlers->call_method(func->common.function_name, fci->object, fci->param_count, fci->retval TSRMLS_CC);
+ fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval TSRMLS_CC);
EG(current_execute_data) = call->prev_execute_data;
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
@@ -908,11 +905,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
}
- if (Z_OBJ(EG(This))) {
- zval_ptr_dtor(&EG(This));
+ if (fci->object && !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ OBJ_RELEASE(fci->object);
}
- Z_OBJ(EG(This)) = orig_object;
EG(scope) = orig_scope;
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;