diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 2648162ae9c0b..10816c4a69ed0 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -204,19 +204,17 @@ typedef struct _zend_ffi_ctype { static zend_class_entry *zend_ffi_exception_ce; static zend_class_entry *zend_ffi_parser_exception_ce; static zend_class_entry *zend_ffi_ce; +static zend_class_entry *zend_ffi_scope_ce; static zend_class_entry *zend_ffi_cdata_ce; static zend_class_entry *zend_ffi_ctype_ce; static zend_object_handlers zend_ffi_handlers; +static zend_object_handlers zend_ffi_scope_handlers; static zend_object_handlers zend_ffi_cdata_handlers; static zend_object_handlers zend_ffi_cdata_value_handlers; static zend_object_handlers zend_ffi_cdata_free_handlers; static zend_object_handlers zend_ffi_ctype_handlers; -static zend_internal_function zend_ffi_new_fn; -static zend_internal_function zend_ffi_cast_fn; -static zend_internal_function zend_ffi_type_fn; - /* forward declarations */ static void _zend_ffi_type_dtor(zend_ffi_type *type); static void zend_ffi_finalize_type(zend_ffi_dcl *dcl); @@ -2279,7 +2277,7 @@ static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) } /* }}} */ -static zend_object *zend_ffi_new(zend_class_entry *class_type) /* {{{ */ +static zend_object *zend_ffi_scope_new(zend_class_entry *class_type) /* {{{ */ { zend_ffi *ffi; @@ -2415,7 +2413,7 @@ static void zend_ffi_scope_hash_dtor(zval *zv) /* {{{ */ } /* }}} */ -static void zend_ffi_free_obj(zend_object *object) /* {{{ */ +static void zend_ffi_scope_free_obj(zend_object *object) /* {{{ */ { zend_ffi *ffi = (zend_ffi*)object; @@ -2475,7 +2473,7 @@ static zend_object *zend_ffi_cdata_clone_obj(zend_object *obj) /* {{{ */ } /* }}} */ -static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */ +static zval *zend_ffi_scope_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */ { zend_ffi *ffi = (zend_ffi*)obj; zend_ffi_symbol *sym = NULL; @@ -2518,7 +2516,7 @@ static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read } /* }}} */ -static zval *zend_ffi_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */ +static zval *zend_ffi_scope_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */ { zend_ffi *ffi = (zend_ffi*)obj; zend_ffi_symbol *sym = NULL; @@ -2870,30 +2868,16 @@ static ZEND_FUNCTION(ffi_trampoline) /* {{{ */ } /* }}} */ -static zend_function *zend_ffi_get_func(zend_object **obj, zend_string *name, const zval *key) /* {{{ */ +static zend_function *zend_ffi_scope_get_func(zend_object **obj, zend_string *name, const zval *key) /* {{{ */ { zend_ffi *ffi = (zend_ffi*)*obj; zend_ffi_symbol *sym = NULL; zend_function *func; zend_ffi_type *type; - if (ZSTR_LEN(name) == sizeof("new") -1 - && (ZSTR_VAL(name)[0] == 'n' || ZSTR_VAL(name)[0] == 'N') - && (ZSTR_VAL(name)[1] == 'e' || ZSTR_VAL(name)[1] == 'E') - && (ZSTR_VAL(name)[2] == 'w' || ZSTR_VAL(name)[2] == 'W')) { - return (zend_function*)&zend_ffi_new_fn; - } else if (ZSTR_LEN(name) == sizeof("cast") -1 - && (ZSTR_VAL(name)[0] == 'c' || ZSTR_VAL(name)[0] == 'C') - && (ZSTR_VAL(name)[1] == 'a' || ZSTR_VAL(name)[1] == 'A') - && (ZSTR_VAL(name)[2] == 's' || ZSTR_VAL(name)[2] == 'S') - && (ZSTR_VAL(name)[3] == 't' || ZSTR_VAL(name)[3] == 'T')) { - return (zend_function*)&zend_ffi_cast_fn; - } else if (ZSTR_LEN(name) == sizeof("type") -1 - && (ZSTR_VAL(name)[0] == 't' || ZSTR_VAL(name)[0] == 'T') - && (ZSTR_VAL(name)[1] == 'y' || ZSTR_VAL(name)[1] == 'Y') - && (ZSTR_VAL(name)[2] == 'p' || ZSTR_VAL(name)[2] == 'P') - && (ZSTR_VAL(name)[3] == 'e' || ZSTR_VAL(name)[3] == 'E')) { - return (zend_function*)&zend_ffi_type_fn; + func = zend_hash_find_ptr_lc(&zend_ffi_scope_ce->function_table, name); + if (func) { + return func; } if (ffi->symbols) { @@ -3063,7 +3047,7 @@ ZEND_METHOD(FFI, cdef) /* {{{ */ } } - ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce); + ffi = (zend_ffi*)zend_ffi_scope_new(zend_ffi_scope_ce); ffi->lib = handle; ffi->symbols = FFI_G(symbols); ffi->tags = FFI_G(tags); @@ -3499,7 +3483,7 @@ static zend_ffi *zend_ffi_load(const char *filename, bool preload) /* {{{ */ } if (EG(objects_store).object_buckets) { - ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce); + ffi = (zend_ffi*)zend_ffi_scope_new(zend_ffi_scope_ce); } else { ffi = ecalloc(1, sizeof(zend_ffi)); } @@ -3507,7 +3491,7 @@ static zend_ffi *zend_ffi_load(const char *filename, bool preload) /* {{{ */ ffi->tags = scope->tags; ffi->persistent = 1; } else { - ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce); + ffi = (zend_ffi*)zend_ffi_scope_new(zend_ffi_scope_ce); ffi->lib = handle; ffi->symbols = FFI_G(symbols); ffi->tags = FFI_G(tags); @@ -3580,7 +3564,7 @@ ZEND_METHOD(FFI, scope) /* {{{ */ RETURN_THROWS(); } - ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce); + ffi = (zend_ffi*)zend_ffi_scope_new(zend_ffi_scope_ce); ffi->symbols = scope->symbols; ffi->tags = scope->tags; @@ -3759,7 +3743,7 @@ static void zend_ffi_tags_cleanup(zend_ffi_dcl *dcl) /* {{{ */ } /* }}} */ -ZEND_METHOD(FFI, new) /* {{{ */ +static void _zend_ffi_new(INTERNAL_FUNCTION_PARAMETERS, bool is_static_call) /* {{{ */ { zend_string *type_def = NULL; zend_object *type_obj = NULL; @@ -3769,7 +3753,6 @@ ZEND_METHOD(FFI, new) /* {{{ */ bool owned = 1; bool persistent = 0; bool is_const = 0; - bool is_static_call = Z_TYPE(EX(This)) != IS_OBJECT; zend_ffi_flags flags = ZEND_FFI_FLAG_OWNED; ZEND_FFI_VALIDATE_API_RESTRICTION(); @@ -3780,13 +3763,6 @@ ZEND_METHOD(FFI, new) /* {{{ */ Z_PARAM_BOOL(persistent) ZEND_PARSE_PARAMETERS_END(); - if (is_static_call) { - zend_error(E_DEPRECATED, "Calling FFI::new() statically is deprecated"); - if (EG(exception)) { - RETURN_THROWS(); - } - } - if (!owned) { flags &= ~ZEND_FFI_FLAG_OWNED; } @@ -3884,6 +3860,18 @@ ZEND_METHOD(FFI, new) /* {{{ */ } /* }}} */ +ZEND_METHOD(FFI, new) /* {{{ */ +{ + _zend_ffi_new(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +ZEND_METHOD(FFI_Scope, new) /* {{{ */ +{ + _zend_ffi_new(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + ZEND_METHOD(FFI, free) /* {{{ */ { zval *zv; @@ -3918,14 +3906,13 @@ ZEND_METHOD(FFI, free) /* {{{ */ } /* }}} */ -ZEND_METHOD(FFI, cast) /* {{{ */ +static void _zend_ffi_cast(INTERNAL_FUNCTION_PARAMETERS, bool is_static_call) /* {{{ */ { zend_string *type_def = NULL; zend_object *ztype = NULL; zend_ffi_type *old_type, *type, *type_ptr; zend_ffi_cdata *old_cdata, *cdata; bool is_const = 0; - bool is_static_call = Z_TYPE(EX(This)) != IS_OBJECT; zval *zv, *arg; void *ptr; @@ -3935,13 +3922,6 @@ ZEND_METHOD(FFI, cast) /* {{{ */ Z_PARAM_ZVAL(zv) ZEND_PARSE_PARAMETERS_END(); - if (is_static_call) { - zend_error(E_DEPRECATED, "Calling FFI::cast() statically is deprecated"); - if (EG(exception)) { - RETURN_THROWS(); - } - } - arg = zv; ZVAL_DEREF(zv); @@ -4101,25 +4081,29 @@ ZEND_METHOD(FFI, cast) /* {{{ */ } /* }}} */ -ZEND_METHOD(FFI, type) /* {{{ */ +ZEND_METHOD(FFI, cast) /* {{{ */ +{ + _zend_ffi_cast(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +ZEND_METHOD(FFI_Scope, cast) /* {{{ */ +{ + _zend_ffi_cast(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +static void _zend_ffi_type(INTERNAL_FUNCTION_PARAMETERS, bool is_static_call) /* {{{ */ { zend_ffi_ctype *ctype; zend_ffi_dcl dcl = ZEND_FFI_ATTR_INIT; zend_string *type_def; - bool is_static_call = Z_TYPE(EX(This)) != IS_OBJECT; ZEND_FFI_VALIDATE_API_RESTRICTION(); ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(type_def); ZEND_PARSE_PARAMETERS_END(); - if (is_static_call) { - zend_error(E_DEPRECATED, "Calling FFI::type() statically is deprecated"); - if (EG(exception)) { - RETURN_THROWS(); - } - } - if (!is_static_call) { zend_ffi *ffi = (zend_ffi*)Z_OBJ(EX(This)); FFI_G(symbols) = ffi->symbols; @@ -4166,6 +4150,18 @@ ZEND_METHOD(FFI, type) /* {{{ */ } /* }}} */ +ZEND_METHOD(FFI, type) /* {{{ */ +{ + _zend_ffi_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +ZEND_METHOD(FFI_Scope, type) /* {{{ */ +{ + _zend_ffi_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + ZEND_METHOD(FFI, typeof) /* {{{ */ { zval *zv, *arg; @@ -5386,30 +5382,6 @@ static zend_result zend_ffi_preload(char *preload) /* {{{ */ } /* }}} */ -/* The startup code for observers adds a temporary to each function for internal use. - * The "new", "cast", and "type" functions in FFI are both static and non-static. - * Only the static versions are in the function table and the non-static versions are not. - * This means the non-static versions will be skipped by the observers startup code. - * This function fixes that by incrementing the temporary count for the non-static versions. - */ -static zend_result (*prev_zend_post_startup_cb)(void); -static zend_result ffi_fixup_temporaries(void) { - if (ZEND_OBSERVER_ENABLED) { - ++zend_ffi_new_fn.T; - ++zend_ffi_cast_fn.T; - ++zend_ffi_type_fn.T; - } -#ifndef ZTS - ZEND_MAP_PTR(zend_ffi_new_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "new", sizeof("new")-1))->run_time_cache); - ZEND_MAP_PTR(zend_ffi_cast_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "cast", sizeof("cast")-1))->run_time_cache); - ZEND_MAP_PTR(zend_ffi_type_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "type", sizeof("type")-1))->run_time_cache); -#endif - if (prev_zend_post_startup_cb) { - return prev_zend_post_startup_cb(); - } - return SUCCESS; -} - /* {{{ ZEND_MINIT_FUNCTION */ ZEND_MINIT_FUNCTION(ffi) { @@ -5422,39 +5394,35 @@ ZEND_MINIT_FUNCTION(ffi) zend_ffi_parser_exception_ce = register_class_FFI_ParserException(zend_ffi_exception_ce); zend_ffi_ce = register_class_FFI(); - zend_ffi_ce->create_object = zend_ffi_new; zend_ffi_ce->default_object_handlers = &zend_ffi_handlers; - memcpy(&zend_ffi_new_fn, zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "new", sizeof("new")-1), sizeof(zend_internal_function)); - zend_ffi_new_fn.fn_flags &= ~ZEND_ACC_STATIC; - memcpy(&zend_ffi_cast_fn, zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "cast", sizeof("cast")-1), sizeof(zend_internal_function)); - zend_ffi_cast_fn.fn_flags &= ~ZEND_ACC_STATIC; - memcpy(&zend_ffi_type_fn, zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "type", sizeof("type")-1), sizeof(zend_internal_function)); - zend_ffi_type_fn.fn_flags &= ~ZEND_ACC_STATIC; - - prev_zend_post_startup_cb = zend_post_startup_cb; - zend_post_startup_cb = ffi_fixup_temporaries; + zend_ffi_scope_ce = register_class_FFI_Scope(); + zend_ffi_scope_ce->create_object = zend_ffi_scope_new; + zend_ffi_scope_ce->default_object_handlers = &zend_ffi_scope_handlers; memcpy(&zend_ffi_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zend_ffi_handlers.get_constructor = zend_fake_get_constructor; - zend_ffi_handlers.free_obj = zend_ffi_free_obj; - zend_ffi_handlers.clone_obj = NULL; - zend_ffi_handlers.read_property = zend_ffi_read_var; - zend_ffi_handlers.write_property = zend_ffi_write_var; - zend_ffi_handlers.read_dimension = zend_fake_read_dimension; - zend_ffi_handlers.write_dimension = zend_fake_write_dimension; - zend_ffi_handlers.get_property_ptr_ptr = zend_fake_get_property_ptr_ptr; - zend_ffi_handlers.has_property = zend_fake_has_property; - zend_ffi_handlers.unset_property = zend_fake_unset_property; - zend_ffi_handlers.has_dimension = zend_fake_has_dimension; - zend_ffi_handlers.unset_dimension = zend_fake_unset_dimension; - zend_ffi_handlers.get_method = zend_ffi_get_func; - zend_ffi_handlers.compare = zend_fake_compare_objects; - zend_ffi_handlers.cast_object = zend_fake_cast_object; - zend_ffi_handlers.get_debug_info = NULL; - zend_ffi_handlers.get_closure = NULL; - zend_ffi_handlers.get_properties = zend_fake_get_properties; - zend_ffi_handlers.get_gc = zend_fake_get_gc; + + memcpy(&zend_ffi_scope_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_ffi_scope_handlers.get_constructor = zend_fake_get_constructor; + zend_ffi_scope_handlers.free_obj = zend_ffi_scope_free_obj; + zend_ffi_scope_handlers.clone_obj = NULL; + zend_ffi_scope_handlers.read_property = zend_ffi_scope_read_var; + zend_ffi_scope_handlers.write_property = zend_ffi_scope_write_var; + zend_ffi_scope_handlers.read_dimension = zend_fake_read_dimension; + zend_ffi_scope_handlers.write_dimension = zend_fake_write_dimension; + zend_ffi_scope_handlers.get_property_ptr_ptr = zend_fake_get_property_ptr_ptr; + zend_ffi_scope_handlers.has_property = zend_fake_has_property; + zend_ffi_scope_handlers.unset_property = zend_fake_unset_property; + zend_ffi_scope_handlers.has_dimension = zend_fake_has_dimension; + zend_ffi_scope_handlers.unset_dimension = zend_fake_unset_dimension; + zend_ffi_scope_handlers.get_method = zend_ffi_scope_get_func; + zend_ffi_scope_handlers.compare = zend_fake_compare_objects; + zend_ffi_scope_handlers.cast_object = zend_fake_cast_object; + zend_ffi_scope_handlers.get_debug_info = NULL; + zend_ffi_scope_handlers.get_closure = NULL; + zend_ffi_scope_handlers.get_properties = zend_fake_get_properties; + zend_ffi_scope_handlers.get_gc = zend_fake_get_gc; zend_ffi_cdata_ce = register_class_FFI_CData(); zend_ffi_cdata_ce->create_object = zend_ffi_cdata_new; diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php index 3fb9ceee3dfa5..3035b12a95b1e 100644 --- a/ext/ffi/ffi.stub.php +++ b/ext/ffi/ffi.stub.php @@ -9,11 +9,11 @@ final class FFI /** @cvalue __BIGGEST_ALIGNMENT__ */ public const int __BIGGEST_ALIGNMENT__ = UNKNOWN; - public static function cdef(string $code = "", ?string $lib = null): FFI {} + public static function cdef(string $code = "", ?string $lib = null): FFI\Scope {} - public static function load(string $filename): ?FFI {} + public static function load(string $filename): ?FFI\Scope {} - public static function scope(string $name): FFI {} + public static function scope(string $name): FFI\Scope {} public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): FFI\CData {} @@ -71,6 +71,19 @@ public static function isNull(FFI\CData $ptr): bool {} namespace FFI { + /** @not-serializable */ + final class Scope { + public function new(CType|string $type, bool $owned = true, bool $persistent = false): CData {} + + /** + * @param CData|int|float|bool|null $ptr + * @prefer-ref $ptr + */ + public function cast(CType|string $type, $ptr): CData {} + + public function type(string $type): CType {} + } + /** @not-serializable */ final class CData { } diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h index 563c9f8b8e8b1..88748b6894034 100644 --- a/ext/ffi/ffi_arginfo.h +++ b/ext/ffi/ffi_arginfo.h @@ -1,16 +1,16 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d3626f5d39317876fc7d4f240b0758f17f3472c8 */ + * Stub hash: 5e33ab4b9af905df8a2a13c14fba9c3dea95577e */ -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI\\Scope, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, lib, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_load, 0, 1, FFI, 1) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_load, 0, 1, FFI\\Scope, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI\\Scope, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -79,6 +79,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_isNull, 0, 1, _IS_BOOL ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0) ZEND_END_ARG_INFO() +#define arginfo_class_FFI_Scope_new arginfo_class_FFI_new + +#define arginfo_class_FFI_Scope_cast arginfo_class_FFI_cast + +#define arginfo_class_FFI_Scope_type arginfo_class_FFI_type + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_CType_getName, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -138,6 +144,9 @@ ZEND_METHOD(FFI, memcmp); ZEND_METHOD(FFI, memset); ZEND_METHOD(FFI, string); ZEND_METHOD(FFI, isNull); +ZEND_METHOD(FFI_Scope, new); +ZEND_METHOD(FFI_Scope, cast); +ZEND_METHOD(FFI_Scope, type); ZEND_METHOD(FFI_CType, getName); ZEND_METHOD(FFI_CType, getKind); ZEND_METHOD(FFI_CType, getSize); @@ -176,6 +185,13 @@ static const zend_function_entry class_FFI_methods[] = { ZEND_FE_END }; +static const zend_function_entry class_FFI_Scope_methods[] = { + ZEND_ME(FFI_Scope, new, arginfo_class_FFI_Scope_new, ZEND_ACC_PUBLIC) + ZEND_ME(FFI_Scope, cast, arginfo_class_FFI_Scope_cast, ZEND_ACC_PUBLIC) + ZEND_ME(FFI_Scope, type, arginfo_class_FFI_Scope_type, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + static const zend_function_entry class_FFI_CType_methods[] = { ZEND_ME(FFI_CType, getName, arginfo_class_FFI_CType_getName, ZEND_ACC_PUBLIC) ZEND_ME(FFI_CType, getKind, arginfo_class_FFI_CType_getKind, ZEND_ACC_PUBLIC) @@ -212,6 +228,16 @@ static zend_class_entry *register_class_FFI(void) return class_entry; } +static zend_class_entry *register_class_FFI_Scope(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "FFI", "Scope", class_FFI_Scope_methods); + class_entry = zend_register_internal_class_with_flags(&ce, NULL, ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE); + + return class_entry; +} + static zend_class_entry *register_class_FFI_CData(void) { zend_class_entry ce, *class_entry; diff --git a/ext/ffi/tests/017.phpt b/ext/ffi/tests/017.phpt index 30f1efdde66ce..766bc4bdae2af 100644 --- a/ext/ffi/tests/017.phpt +++ b/ext/ffi/tests/017.phpt @@ -24,13 +24,8 @@ try { ?> ok --EXPECTF-- -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d FFI\ParserException: function type is not allowed at line 1 - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d FFI\ParserException: Struct/union can't contain an instance of itself at line 1 - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d object(FFI\CData:struct X)#%d (1) { ["ptr"]=> NULL diff --git a/ext/ffi/tests/021.phpt b/ext/ffi/tests/021.phpt index 87cf75348d8fe..ceaf96d7b95aa 100644 --- a/ext/ffi/tests/021.phpt +++ b/ext/ffi/tests/021.phpt @@ -53,66 +53,5 @@ test(4, "enum __attribute__((packed)) {a14=-0x80000000}"); test(8, "enum __attribute__((packed)) {a14=-0x80000001}"); ?> ok ---EXPECTF-- -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d - -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d +--EXPECT-- ok diff --git a/ext/ffi/tests/046.phpt b/ext/ffi/tests/046.phpt index 0cea22eba78f3..33539d6d32afa 100644 --- a/ext/ffi/tests/046.phpt +++ b/ext/ffi/tests/046.phpt @@ -52,26 +52,17 @@ var_dump($x->getPointerType()->getFuncParameterType(0)->getKind() === $x::TYPE_D var_dump($x->getPointerType()->getFuncParameterType(1)->getKind() === $x::TYPE_SINT32); ?> --EXPECTF-- -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) int(1) int(1) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) bool(true) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) int(5) bool(true) int(5) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) bool(true) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) bool(false) array(2) { @@ -84,8 +75,6 @@ int(0) int(8) bool(true) bool(true) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) bool(true) array(2) { @@ -98,8 +87,6 @@ int(0) int(0) bool(true) bool(true) - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d bool(true) bool(true) bool(true) diff --git a/ext/ffi/tests/bug79177.phpt b/ext/ffi/tests/bug79177.phpt index 2b6e449d36d6a..da49262fd8fed 100644 --- a/ext/ffi/tests/bug79177.phpt +++ b/ext/ffi/tests/bug79177.phpt @@ -33,7 +33,7 @@ echo "done\n"; Warning: Uncaught RuntimeException: Not allowed in %s:%d Stack trace: #0 %s(%d): {closure:%s:%d}() -#1 %s(%d): FFI->bug79177() +#1 %s(%d): FFI\Scope->bug79177() #2 {main} thrown in %s on line %d diff --git a/ext/ffi/tests/deprecations.phpt b/ext/ffi/tests/deprecations.phpt index d62a214712d0e..07e0cfb52d75e 100644 --- a/ext/ffi/tests/deprecations.phpt +++ b/ext/ffi/tests/deprecations.phpt @@ -45,17 +45,9 @@ try { ?> --EXPECTF-- -Deprecated: Calling FFI::new() statically is deprecated in %s on line %d -Calling FFI::new() statically is deprecated object(FFI\CData:uint8_t[2])#1 (2) { [0]=> int(0) [1]=> int(0) } - -Deprecated: Calling FFI::type() statically is deprecated in %s on line %d -Calling FFI::type() statically is deprecated - -Deprecated: Calling FFI::cast() statically is deprecated in %s on line %d -Calling FFI::cast() statically is deprecated diff --git a/ext/ffi/tests/gh12905.phpt b/ext/ffi/tests/gh12905.phpt index 2fe9ef0fab86e..79fcdd94f03cf 100644 --- a/ext/ffi/tests/gh12905.phpt +++ b/ext/ffi/tests/gh12905.phpt @@ -28,7 +28,7 @@ $ffi->new("int"); - - - + + +