From 6410f1ed7631ef1d64f010f1f13f16ba89257ae3 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 11 Feb 2023 22:00:14 +0100 Subject: [PATCH] Fix assertion failure when var_dump'ing void FFI result --- ext/ffi/ffi.c | 2 ++ ext/ffi/tests/gh10568.phpt | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 ext/ffi/tests/gh10568.phpt diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 107d2862c1256..ee5183ce9d46c 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -1982,6 +1982,8 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) } switch (type->kind) { + case ZEND_FFI_TYPE_VOID: + return NULL; case ZEND_FFI_TYPE_BOOL: case ZEND_FFI_TYPE_CHAR: case ZEND_FFI_TYPE_ENUM: diff --git a/ext/ffi/tests/gh10568.phpt b/ext/ffi/tests/gh10568.phpt new file mode 100644 index 0000000000000..bd76671438d1b --- /dev/null +++ b/ext/ffi/tests/gh10568.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-10568 (Assertion failure when var_dump'ing void FFI result) +--EXTENSIONS-- +ffi +--SKIPIF-- + +--INI-- +ffi.enable=1 +--FILE-- +strlen("abc")); +?> +DONE +--EXPECT-- +object(FFI\CData:void)#2 (0) { +} +DONE