summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-10-05 23:11:17 +0200
committerNikita Popov <nikic@php.net>2014-10-05 23:11:17 +0200
commit9bc14f9632739274d7d3430759f77f272bf63241 (patch)
treee92ce5cd0f567349aed0b54967a983798ea28040
parentfb34cd90f8a26d32f4eab179c4192d13a87c856c (diff)
downloadphp-git-9bc14f9632739274d7d3430759f77f272bf63241.tar.gz
Fix dynamic calls to static methods with fci->object
func may already be freed at the time the static flag was checked.
-rw-r--r--Zend/zend_execute_API.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 9fdb2ee4f5..1da64bb978 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -829,8 +829,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
call->num_args = fci->param_count;
EG(scope) = calling_scope;
- if (!fci->object ||
- (func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_STATIC) {
+ fci->object = NULL;
+ }
+ if (!fci->object) {
Z_OBJ(call->This) = NULL;
Z_TYPE_INFO(call->This) = IS_UNDEF;
} else {
@@ -908,7 +910,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
}
- if (fci->object && !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fci->object) {
OBJ_RELEASE(fci->object);
}