Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created January 28, 2020 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstogov/1195bede1f22d169acb6a9d03d22fbfa to your computer and use it in GitHub Desktop.
Save dstogov/1195bede1f22d169acb6a9d03d22fbfa to your computer and use it in GitHub Desktop.
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index f43ba2adc8..2a8e213280 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -877,6 +877,11 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
}
free_alloca(fci.params, use_heap);
+ if (EG(exception)) {
+ zend_error(E_WARNING, "Uncaught %s in PHP FFI callback", ZSTR_VAL(EG(exception)->ce->name));
+ zend_exception_error(EG(exception), E_ERROR);
+ }
+
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment