summaryrefslogtreecommitdiff
path: root/Zend/zend_closures.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-01-11 22:15:45 +0300
committerDmitry Stogov <dmitry@zend.com>2018-01-11 22:15:45 +0300
commit12c386f5b90387ce373e16cdf74fd4d3155d5aa7 (patch)
tree2103adb0a72abeba6cffd90b96e1ab8392747d1c /Zend/zend_closures.c
parent0ec631c99676039f7056e939cfd34a7918c1246c (diff)
downloadphp-git-12c386f5b90387ce373e16cdf74fd4d3155d5aa7.tar.gz
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573afdc7c336b3577ceabc9c65cafea17e8, now it should be OK).
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 952c018157..af4c474830 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)) {