summaryrefslogtreecommitdiff
path: root/Zend/zend_closures.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-01-11 16:25:28 +0300
committerDmitry Stogov <dmitry@zend.com>2018-01-11 16:25:28 +0300
commit781e1573afdc7c336b3577ceabc9c65cafea17e8 (patch)
treeb9738020d342fac1c28b2517687008947117e19d /Zend/zend_closures.c
parent35e70af2085300418cab4a801730dbeb05d5d222 (diff)
downloadphp-git-781e1573afdc7c336b3577ceabc9c65cafea17e8.tar.gz
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse.
Diffstat (limited to 'Zend/zend_closures.c')
-rw-r--r--Zend/zend_closures.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index b60107c9e5..d471718783 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -639,7 +639,7 @@ void zend_register_closure_ce(void) /* {{{ */
static ZEND_NAMED_FUNCTION(zend_closure_internal_handler) /* {{{ */
{
- zend_closure *closure = (zend_closure*)EX(func)->common.prototype;
+ zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func));
closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
OBJ_RELEASE((zend_object*)closure);
EX(func) = NULL;
@@ -662,7 +662,6 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
if (func->type == ZEND_USER_FUNCTION) {
memcpy(&closure->func, func, sizeof(zend_op_array));
- closure->func.common.prototype = (zend_function*)closure;
closure->func.common.fn_flags |= ZEND_ACC_CLOSURE;
if (closure->func.op_array.static_variables) {
closure->func.op_array.static_variables =
@@ -677,7 +676,6 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
}
} else {
memcpy(&closure->func, func, sizeof(zend_internal_function));
- closure->func.common.prototype = (zend_function*)closure;
closure->func.common.fn_flags |= ZEND_ACC_CLOSURE;
/* wrap internal function handler to avoid memory leak */
if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) {