summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2012-06-22 12:05:29 -0300
committerFelipe Pena <felipensp@gmail.com>2012-06-22 12:05:29 -0300
commitb8e946b02eac53f46cbfc8eefb5c91fb5b075c9d (patch)
tree87d9b8277f4356c39dacf6fba028bf433b371a68 /ext/reflection/php_reflection.c
parent055ecbc62878e86287d742c7246c21606cee8183 (diff)
downloadphp-git-b8e946b02eac53f46cbfc8eefb5c91fb5b075c9d.tar.gz
- Fixed bug #62384 (Attempting to invoke a Closure more than once causes segfaul)
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ca90269fcd..966c9a5448 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2747,6 +2747,16 @@ ZEND_METHOD(reflection_method, invokeArgs)
fcc.calling_scope = obj_ce;
fcc.called_scope = intern->ce;
fcc.object_ptr = object;
+
+ /*
+ * Closure::__invoke() actually expects a copy of zend_function, so that it
+ * frees it after the invoking.
+ */
+ if (obj_ce == zend_ce_closure && object &&
+ strlen(mptr->common.function_name) == sizeof(ZEND_INVOKE_FUNC_NAME)-1 &&
+ memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) {
+ fcc.function_handler = _copy_function(mptr TSRMLS_CC);
+ }
result = zend_call_function(&fci, &fcc TSRMLS_CC);