@@ -4427,6 +4427,26 @@ ZEND_METHOD(FFI, isNull) /* {{{ */
4427
4427
}
4428
4428
/* }}} */
4429
4429
4430
+
4431
+ ZEND_METHOD (CType , getName ) /* {{{ */
4432
+ {
4433
+ zend_ffi_ctype * ctype = (zend_ffi_ctype * )(Z_OBJ_P (ZEND_THIS ));
4434
+ if (zend_parse_parameters_none () == FAILURE ) {
4435
+ RETURN_THROWS ();
4436
+ }
4437
+
4438
+ zend_ffi_ctype_name_buf buf ;
4439
+
4440
+ buf .start = buf .end = buf .buf + ((MAX_TYPE_NAME_LEN * 3 ) / 4 );
4441
+ if (!zend_ffi_ctype_name (& buf , ZEND_FFI_TYPE (ctype -> type ))) {
4442
+ RETURN_STR_COPY (Z_OBJ_P (ZEND_THIS )-> ce -> name );
4443
+ } else {
4444
+ size_t len = buf .end - buf .start ;
4445
+ zend_string * res = zend_string_init (buf .start , len , 0 );
4446
+ RETURN_STR (res );
4447
+ }
4448
+ }
4449
+
4430
4450
static char * zend_ffi_parse_directives (const char * filename , char * code_pos , char * * scope_name , char * * lib , zend_bool preload ) /* {{{ */
4431
4451
{
4432
4452
char * p ;
@@ -4984,7 +5004,7 @@ ZEND_MINIT_FUNCTION(ffi)
4984
5004
zend_ffi_cdata_free_handlers .get_properties = zend_fake_get_properties ;
4985
5005
zend_ffi_cdata_free_handlers .get_gc = zend_fake_get_gc ;
4986
5006
4987
- INIT_NS_CLASS_ENTRY (ce , "FFI" , "CType" , NULL );
5007
+ INIT_NS_CLASS_ENTRY (ce , "FFI" , "CType" , class_CType_methods );
4988
5008
zend_ffi_ctype_ce = zend_register_internal_class (& ce );
4989
5009
zend_ffi_ctype_ce -> ce_flags |= ZEND_ACC_FINAL ;
4990
5010
zend_ffi_ctype_ce -> create_object = zend_ffi_ctype_new ;
@@ -5004,7 +5024,7 @@ ZEND_MINIT_FUNCTION(ffi)
5004
5024
zend_ffi_ctype_handlers .unset_property = zend_fake_unset_property ;
5005
5025
zend_ffi_ctype_handlers .has_dimension = zend_fake_has_dimension ;
5006
5026
zend_ffi_ctype_handlers .unset_dimension = zend_fake_unset_dimension ;
5007
- zend_ffi_ctype_handlers .get_method = zend_fake_get_method ;
5027
+ // zend_ffi_ctype_handlers.get_method = zend_fake_get_method;
5008
5028
zend_ffi_ctype_handlers .get_class_name = zend_ffi_ctype_get_class_name ;
5009
5029
zend_ffi_ctype_handlers .compare = zend_ffi_ctype_compare_objects ;
5010
5030
zend_ffi_ctype_handlers .cast_object = zend_fake_cast_object ;
0 commit comments