diff options
author | Felipe Pena <felipensp@gmail.com> | 2012-06-22 12:06:05 -0300 |
---|---|---|
committer | Felipe Pena <felipensp@gmail.com> | 2012-06-22 12:06:05 -0300 |
commit | d980e9599772acfedbfaf7a5c521060b1e10fc59 (patch) | |
tree | a4afc842096ee5a44201a4f394378456b2360ac0 /ext/reflection/php_reflection.c | |
parent | 4f5c7ee24074d2de5f4a8569007d3fa31e3f9386 (diff) | |
parent | 4af92aca872d7463b671c037f9d3b782e22a7c9c (diff) | |
download | php-git-d980e9599772acfedbfaf7a5c521060b1e10fc59.tar.gz |
Merge branch 'PHP-5.4'
* PHP-5.4:
- 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.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 9346587eb7..ab5b15cbd4 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2923,6 +2923,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); |