diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-10-05 17:49:32 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-10-05 17:49:32 +0200 |
commit | 35d0405c4790f0ce668c9e1b8b05197e55d29a05 (patch) | |
tree | fcb9d5fe2e447ba17f3ff81b19baaa989b2bf38c /Zend/zend_execute_API.c | |
parent | a6be0f3fd6cdd59ac00ecd76630c6c04fee03417 (diff) | |
download | php-git-35d0405c4790f0ce668c9e1b8b05197e55d29a05.tar.gz |
Allow random $this on non-internal Closures again
As it turns out, there is actually no reason to prevent this, it even was a bigger BC break than expected...
Also fixes a memory leak (the Closure leaks) when calling internal functions via Closure by moving it out of leave helper onto caller side for TOP_CODE:
$z = new SplStack; $z->push(20);
$x = (new ReflectionMethod("SplStack", "pop"))->getClosure($z);
var_dump($x());
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 965b08eb38..2030e0265a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -851,6 +851,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) { zend_init_execute_data(call, &func->op_array, fci->retval); zend_execute_ex(call); + if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) { + OBJ_RELEASE((zend_object*)func->op_array.prototype); + } } else { zend_generator_create_zval(call, &func->op_array, fci->retval); } |