@@ -357,17 +357,26 @@ function is_cdata($ptr): bool
357357 }
358358
359359 /**
360- * Checks whether the given object is `FFI\CData`, and has the given `field`.
360+ * Checks whether the given _c struct_ object is `FFI\CData`, and has the given member `field`.
361361 *
362362 * @param object $ptr
363- * @param string $field
363+ * @param string $field member depth, up three levels *c_field0->c_field1->c_field2*
364364 * @return boolean
365365 */
366- function is_cdata_valid (object $ ptr , string $ field )
366+ function is_cdata_valid (object $ ptr , string $ field ): bool
367367 {
368368 try {
369- $ isValid = \ffi_object ($ ptr )->{$ field };
370- return \is_null ($ isValid ) || !\is_null ($ isValid );
369+ if (\strpos ($ field , '-> ' ) !== false ) {
370+ $ fields = \explode ('-> ' , $ field );
371+ if (\count ($ fields ) == 3 )
372+ \ffi_object ($ ptr )->{$ fields [0 ]}->{$ fields [1 ]}->{$ fields [2 ]};
373+ elseif (\count ($ fields ) == 2 )
374+ \ffi_object ($ ptr )->{$ fields [0 ]}->{$ fields [1 ]};
375+ } else {
376+ \ffi_object ($ ptr )->{$ field };
377+ }
378+
379+ return true ;
371380 } catch (\Throwable $ e ) {
372381 return false ;
373382 }
@@ -639,7 +648,7 @@ function zend_preloader(): void
639648 if (\IS_WINDOWS ) {
640649 $ mmap_header = __DIR__ . '\\headers \\windows_mman.h ' ;
641650 if (\file_exists ('vendor \\symplely \\zend-ffi ' )) {
642- $ vendor_code = \str_replace ('.h ' , '_vendor .h ' , $ mmap_header );
651+ $ vendor_code = \str_replace ('.h ' , '_generated .h ' , $ mmap_header );
643652 if (!\file_exists ($ vendor_code )) {
644653 $ file = \str_replace (
645654 'FFI_LIB ". ' ,
0 commit comments