com php-src: Fixed support for callbacks with "void" return type: ext/ffi/ffi.c
| From: | Dmitry Stogov | Date: | Mon, 04 Mar 2019 22:03:47 +0000 |
| Subject: | com php-src: Fixed support for callbacks with "void" return type: ext/ffi/ffi.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105002@lists.php.net to get a copy of this message | ||
Commit: ff5fa0d6312e80c4862f046e29efee2db9cda1cd
Author: Dmitry Stogov <dmitry@zend.com> Tue, 5 Mar 2019 01:03:47 +0300
Parents: d4d0e2e6b84d23b7ca1a608009ce1506551c0d31
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ff5fa0d6312e80c4862f046e29efee2db9cda1cd
Log:
Fixed support for callbacks with "void" return type
Changed paths:
M ext/ffi/ffi.c
Diff:
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index f88fe43..95af75a 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -750,6 +750,7 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
{
zend_ffi_callback_data *callback_data = (zend_ffi_callback_data*)data;
zend_fcall_info fci;
+ zend_ffi_type *ret_type;
zval retval;
ALLOCA_FLAG(use_heap)
@@ -787,7 +788,10 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args,
v
}
free_alloca(fci.params, use_heap);
- zend_ffi_zval_to_cdata(ret, ZEND_FFI_TYPE(callback_data->type->func.ret_type), &retval);
+ ret_type = ZEND_FFI_TYPE(callback_data->type->func.ret_type);
+ if (ret_type->kind != ZEND_FFI_TYPE_VOID) {
+ zend_ffi_zval_to_cdata(ret, ret_type, &retval);
+ }
}
/* }}} */