summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-04-12 02:35:42 +0300
committerDmitry Stogov <dmitry@zend.com>2019-04-12 02:35:42 +0300
commit55cc280429c453a89e33de7357fa80589470dfc3 (patch)
tree4185afc2c6405d42751fc354a20676be9408d904 /Zend/zend_execute_API.c
parent88a2268d6b9ff152399a8761dc826ce414c0b985 (diff)
downloadphp-git-55cc280429c453a89e33de7357fa80589470dfc3.tar.gz
Backported call frame initialization improvement
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index ab1ef9fa49..794e6863dd 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -655,6 +655,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
+ uint32_t call_info;
+ void *object_or_called_scope;
ZVAL_UNDEF(fci->retval);
@@ -727,11 +729,18 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
}
func = fci_cache->function_handler;
- fci->object = (func->common.fn_flags & ZEND_ACC_STATIC) ?
- NULL : fci_cache->object;
+ if ((func->common.fn_flags & ZEND_ACC_STATIC) || !fci_cache->object) {
+ fci->object = NULL;
+ object_or_called_scope = fci_cache->called_scope;
+ call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC;
+ } else {
+ fci->object = fci_cache->object;
+ object_or_called_scope = fci->object;
+ call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_HAS_THIS;
+ }
- call = zend_vm_stack_push_call_frame(ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC,
- func, fci->param_count, fci_cache->called_scope, fci->object);
+ call = zend_vm_stack_push_call_frame(call_info,
+ func, fci->param_count, object_or_called_scope);
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_DEPRECATED)) {
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",