php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #80847
Patch incomplete-solution revision 2021-03-08 20:29 UTC by nawarian at gmail dot com

Patch incomplete-solution for ffi Bug #80847

Patch version 2021-03-08 20:29 UTC

Return to Bug #80847 | Download this patch
Patch Revisions:

Developer: nawarian@gmail.com

diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index d119ea050c..633a29c721 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -58,6 +58,7 @@ typedef enum _zend_ffi_tag_kind {
 
 static const char *zend_ffi_tag_kind_name[3] = {"enum", "struct", "union"};
 
+static ffi_type *zend_ffi_get_type(zend_ffi_type *type);
 
 typedef struct _zend_ffi_tag {
 	zend_ffi_tag_kind      kind;
@@ -339,6 +340,11 @@ static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */
 			case ZEND_FFI_TYPE_POINTER:
 				t->elements[i] = &ffi_type_pointer;
 				break;
+            case ZEND_FFI_TYPE_STRUCT:
+                t->elements[i] = zend_ffi_get_type(
+                    ZEND_FFI_TYPE(field->type)
+                );
+                break;
 			default:
 				efree(t);
 				return NULL;
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jun 16 02:01:24 2021 UTC