com php-src: Fixed reference cuntmting for closures (previously we didn't increment reference counter for "internal" closures):
Zend/zend_execute_API.c

From: Date: Thu, 08 Oct 2015 23:39:07 +0000
Subject: com php-src: Fixed reference cuntmting for closures (previously we didn't increment reference counter for "internal" closures):
Zend/zend_execute_API.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89329@lists.php.net to get a copy of this message
Commit: c6af0aa33f6dafe90f60b3d20231837f9e25dfb6 Author: Dmitry Stogov <dmitry@zend.com> Fri, 9 Oct 2015 02:39:07 +0300 Parents: 93748bf9ddf971e42917565e35e122af96be85a6 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c6af0aa33f6dafe90f60b3d20231837f9e25dfb6 Log: Fixed reference cuntmting for closures (previously we didn't increment reference counter for "internal" closures) Changed paths: M Zend/zend_execute_API.c Diff: diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 965b08e..9d255ed 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -839,15 +839,16 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / } Z_OBJ(call->This) = fci->object; + if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) { + ZEND_ASSERT(GC_TYPE((zend_object*)func->op_array.prototype) == IS_OBJECT); + GC_REFCOUNT((zend_object*)func->op_array.prototype)++; + ZEND_ADD_CALL_FLAG(call, ZEND_CALL_CLOSURE); + } + if (func->type == ZEND_USER_FUNCTION) { int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0; EG(scope) = func->common.scope; call->symbol_table = fci->symbol_table; - if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) { - ZEND_ASSERT(GC_TYPE((zend_object*)func->op_array.prototype) == IS_OBJECT); - GC_REFCOUNT((zend_object*)func->op_array.prototype)++; - ZEND_ADD_CALL_FLAG(call, ZEND_CALL_CLOSURE); - } 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);

« previous php.cvs (#89329) next »