diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-17 13:42:42 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-22 15:24:03 +0100 |
commit | 4c6533c257cfabd5dd78988bb277f410b2778140 (patch) | |
tree | 81f77c32eb3daf8012427417801b9a66afce8f41 | |
parent | d03be8bf8613571965ec5c033f6dcd607346352a (diff) | |
download | php-git-4c6533c257cfabd5dd78988bb277f410b2778140.tar.gz |
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
39 files changed, 345 insertions, 125 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 94a119eeec..94a9502bc9 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -32,10 +32,7 @@ /* }}} */ ZEND_MINIT_FUNCTION(core) { /* {{{ */ - zend_class_entry class_entry; - - INIT_CLASS_ENTRY(class_entry, "stdClass", NULL); - zend_standard_class_def = zend_register_internal_class(&class_entry); + zend_standard_class_def = register_class_stdClass(); zend_register_default_classes(); diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index 6e6175a693..87a530200d 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -2,6 +2,10 @@ /** @generate-class-entries */ +class stdClass +{ +} + function zend_version(): string {} function func_num_args(): int {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index abf380537e..6baaead27d 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b2216a294367f50c8b6208653ebf6fa43dc106d1 */ + * Stub hash: 429fc9b22054348101d0b9d6746494e52dc04edf */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -333,3 +333,18 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(gc_status, arginfo_gc_status) ZEND_FE_END }; + + +static const zend_function_entry class_stdClass_methods[] = { + ZEND_FE_END +}; + +static zend_class_entry *register_class_stdClass(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "stdClass", class_stdClass_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 5e2c1f69de..6c256e7fc0 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -159,40 +159,33 @@ static PHP_GINIT_FUNCTION(com_dotnet) /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(com_dotnet) { - zend_class_entry ce, *tmp; + zend_class_entry *tmp; php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU); php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU); - INIT_CLASS_ENTRY(ce, "com_exception", NULL); - php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); - php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; + php_com_exception_class_entry = register_class_com_exception(zend_ce_exception); /* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */ - INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL); - php_com_saproxy_class_entry = zend_register_internal_class(&ce); - php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL; + php_com_saproxy_class_entry = register_class_com_safearray_proxy(); /* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */ php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get; - INIT_CLASS_ENTRY(ce, "variant", class_variant_methods); - ce.create_object = php_com_object_new; - php_com_variant_class_entry = zend_register_internal_class(&ce); + php_com_variant_class_entry = register_class_variant(); + php_com_variant_class_entry->create_object = php_com_object_new; php_com_variant_class_entry->get_iterator = php_com_iter_get; php_com_variant_class_entry->serialize = zend_class_serialize_deny; php_com_variant_class_entry->unserialize = zend_class_unserialize_deny; - INIT_CLASS_ENTRY(ce, "com", class_com_methods); - ce.create_object = php_com_object_new; - tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry); + tmp = register_class_com(php_com_variant_class_entry); + tmp->create_object = php_com_object_new; tmp->get_iterator = php_com_iter_get; tmp->serialize = zend_class_serialize_deny; tmp->unserialize = zend_class_unserialize_deny; #if HAVE_MSCOREE_H - INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods); - ce.create_object = php_com_object_new; - tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry); + tmp = register_class_dotnet(php_com_variant_class_entry); + tmp->create_object = php_com_object_new; tmp->get_iterator = php_com_iter_get; tmp->serialize = zend_class_serialize_deny; tmp->unserialize = zend_class_unserialize_deny; diff --git a/ext/com_dotnet/com_extension.stub.php b/ext/com_dotnet/com_extension.stub.php index e3194efe06..8c46f319b9 100644 --- a/ext/com_dotnet/com_extension.stub.php +++ b/ext/com_dotnet/com_extension.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function variant_set(variant $variant, mixed $value): void {} @@ -71,18 +71,22 @@ class variant public function __construct(mixed $value = null, int $type = VT_EMPTY, int $codepage = CP_ACP) {} } -class com +class com extends variant { public function __construct(string $module_name, array|string|null $server_name = null, int $codepage = CP_ACP, string $typelib = "") {} } #if HAVE_MSCOREE_H -class dotnet +class dotnet extends variant { public function __construct(string $assembly_name, string $datatype_name, int $codepage = CP_ACP) {} } #endif -final class com_exception extends exception +final class com_safearray_proxy +{ +} + +final class com_exception extends Exception { } diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h index d290161fd0..cf9a08e711 100644 --- a/ext/com_dotnet/com_extension_arginfo.h +++ b/ext/com_dotnet/com_extension_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6b162963bcceb90144fdd3165137fb567f916812 */ + * Stub hash: ba77cee0a718bcbe7ac280f07a41f9e97a8e2246 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, variant, variant, 0) @@ -228,6 +228,63 @@ static const zend_function_entry class_dotnet_methods[] = { }; +static const zend_function_entry class_com_safearray_proxy_methods[] = { + ZEND_FE_END +}; + + static const zend_function_entry class_com_exception_methods[] = { ZEND_FE_END }; + +static zend_class_entry *register_class_variant(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "variant", class_variant_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +static zend_class_entry *register_class_com(zend_class_entry *class_entry_variant) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "com", class_com_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_variant); + + return class_entry; +} + +static zend_class_entry *register_class_dotnet(zend_class_entry *class_entry_variant) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_variant); + + return class_entry; +} + +static zend_class_entry *register_class_com_safearray_proxy(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "com_safearray_proxy", class_com_safearray_proxy_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + +static zend_class_entry *register_class_com_exception(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "com_exception", class_com_exception_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index bf0f7062fb..2c2cc4226e 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -721,16 +721,12 @@ static zend_object* helper_new(zend_class_entry *ce) int php_com_persist_minit(INIT_FUNC_ARGS) { - zend_class_entry ce; - memcpy(&helper_handlers, &std_object_handlers, sizeof(helper_handlers)); helper_handlers.free_obj = helper_free_storage; helper_handlers.clone_obj = helper_clone; - INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods); - ce.create_object = helper_new; - helper_ce = zend_register_internal_class(&ce); - helper_ce->ce_flags |= ZEND_ACC_FINAL; + helper_ce = register_class_COMPersistHelper(); + helper_ce->create_object = helper_new; le_istream = zend_register_list_destructors_ex(istream_dtor, NULL, "com_dotnet_istream_wrapper", module_number); diff --git a/ext/com_dotnet/com_persist.stub.php b/ext/com_dotnet/com_persist.stub.php index b0e9ef6b5c..2a2b7ac5cb 100644 --- a/ext/com_dotnet/com_persist.stub.php +++ b/ext/com_dotnet/com_persist.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ final class COMPersistHelper { diff --git a/ext/com_dotnet/com_persist_arginfo.h b/ext/com_dotnet/com_persist_arginfo.h index dc8bd6fa48..410782098d 100644 --- a/ext/com_dotnet/com_persist_arginfo.h +++ b/ext/com_dotnet/com_persist_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2c2759e6c1894713439e3ee8da7f56810d00d8cf */ + * Stub hash: d14d30fb232f08da37ba0df0b9186eb8bac5e1a4 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_COMPersistHelper___construct, 0, 0, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, variant, variant, 1, "null") @@ -52,3 +52,14 @@ static const zend_function_entry class_COMPersistHelper_methods[] = { ZEND_ME(COMPersistHelper, SaveToStream, arginfo_class_COMPersistHelper_SaveToStream, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_COMPersistHelper(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 24e1ea646a..0c5fc9778f 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -132,11 +132,6 @@ void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc); void dom_parent_node_before(dom_object *context, zval *nodes, int nodesc); void dom_child_node_remove(dom_object *context); -#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \ -INIT_CLASS_ENTRY(ce, name, funcs); \ -ce.create_object = dom_objects_new; \ -entry = zend_register_internal_class_ex(&ce, parent_ce); - #define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \ __intern = Z_DOMOBJ_P(__id); \ if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \ diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt index e90209ee67..5c4d1cb87f 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt @@ -7,14 +7,14 @@ Felix De Vliegher <felix.devliegher@gmail.com> $standard = new ReflectionExtension('standard'); var_dump($standard->getClassNames()); ?> ---EXPECTF-- +--EXPECT-- array(4) { [0]=> - %s(22) "__PHP_Incomplete_Class" + string(22) "__PHP_Incomplete_Class" [1]=> - %s(15) "php_user_filter" + string(14) "AssertionError" [2]=> - %s(9) "Directory" + string(15) "php_user_filter" [3]=> - %s(14) "AssertionError" + string(9) "Directory" } diff --git a/ext/standard/assert.c b/ext/standard/assert.c index fae6d940ba..8b2e25fcc5 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -32,8 +32,6 @@ ZEND_END_MODULE_GLOBALS(assert) ZEND_DECLARE_MODULE_GLOBALS(assert) -static zend_class_entry *assertion_error_ce; - #define ASSERTG(v) ZEND_MODULE_GLOBALS_ACCESSOR(assert, v) #define SAFE_STRING(s) ((s)?(s):"") @@ -46,6 +44,8 @@ enum { ASSERT_EXCEPTION }; +PHPAPI zend_class_entry *assertion_error_ce; + static PHP_INI_MH(OnChangeCallback) /* {{{ */ { if (EG(current_execute_data)) { @@ -89,8 +89,6 @@ static void php_assert_init_globals(zend_assert_globals *assert_globals_p) /* {{ PHP_MINIT_FUNCTION(assert) /* {{{ */ { - zend_class_entry ce; - ZEND_INIT_MODULE_GLOBALS(assert, php_assert_init_globals, NULL); REGISTER_INI_ENTRIES(); @@ -101,9 +99,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); - INIT_CLASS_ENTRY(ce, "AssertionError", NULL); - assertion_error_ce = zend_register_internal_class_ex(&ce, zend_ce_error); - return SUCCESS; } /* }}} */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4084f5d853..1a6326624b 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -283,7 +283,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ #endif #endif - php_register_incomplete_class(); + php_ce_incomplete_class = register_class___PHP_Incomplete_Class(); + php_register_incomplete_class_handlers(); + + assertion_error_ce = register_class_AssertionError(zend_ce_error); REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 3a7e0de174..83000d5b09 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -1,6 +1,14 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ + +final class __PHP_Incomplete_Class +{ +} + +class AssertionError extends Error +{ +} /* main/main.c */ diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 1c7f6b00ec..f44a322267 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e9f39cbc595f0f2cdd84e58d4857f9fdb03ff7b7 */ + * Stub hash: 97edf8c87780c892984099e52ad1c6c745b919f8 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -3491,3 +3491,34 @@ static const zend_function_entry ext_functions[] = { #endif ZEND_FE_END }; + + +static const zend_function_entry class___PHP_Incomplete_Class_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_AssertionError_methods[] = { + ZEND_FE_END +}; + +static zend_class_entry *register_class___PHP_Incomplete_Class(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "__PHP_Incomplete_Class", class___PHP_Incomplete_Class_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + +static zend_class_entry *register_class_AssertionError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "AssertionError", class_AssertionError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} diff --git a/ext/standard/dir.c b/ext/standard/dir.c index e2b6f5bb3d..c75db7e45a 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -112,10 +112,8 @@ PHP_RINIT_FUNCTION(dir) PHP_MINIT_FUNCTION(dir) { static char dirsep_str[2], pathsep_str[2]; - zend_class_entry dir_class_entry; - INIT_CLASS_ENTRY(dir_class_entry, "Directory", class_Directory_methods); - dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry); + dir_class_entry_ptr = register_class_Directory(); #ifdef ZTS ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL); diff --git a/ext/standard/dir.stub.php b/ext/standard/dir.stub.php index 9904c6bc99..9cafa29c37 100755 --- a/ext/standard/dir.stub.php +++ b/ext/standard/dir.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class Directory { diff --git a/ext/standard/dir_arginfo.h b/ext/standard/dir_arginfo.h index a2fa03611c..1ad629204c 100644 --- a/ext/standard/dir_arginfo.h +++ b/ext/standard/dir_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a715bf6a8d5fe69732623cc17f03bd463f369648 */ + * Stub hash: 1fd5cc5147c7272006e59d63d68c12caec84589f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Directory_close, 0, 0, 0) ZEND_END_ARG_INFO() @@ -20,3 +20,13 @@ static const zend_function_entry class_Directory_methods[] = { ZEND_ME_MAPPING(read, readdir, arginfo_class_Directory_read, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_Directory(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Directory", class_Directory_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 0ca2443eb2..c59eb2d52c 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -108,14 +108,8 @@ static zend_object *php_create_incomplete_object(zend_class_entry *class_type) return object; } -PHPAPI void php_register_incomplete_class(void) +PHPAPI void php_register_incomplete_class_handlers(void) { - zend_class_entry incomplete_class; - - INIT_CLASS_ENTRY(incomplete_class, INCOMPLETE_CLASS, NULL); - - incomplete_class.create_object = php_create_incomplete_object; - memcpy(&php_incomplete_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); php_incomplete_object_handlers.read_property = incomplete_class_get_property; php_incomplete_object_handlers.has_property = incomplete_class_has_property; @@ -124,8 +118,7 @@ PHPAPI void php_register_incomplete_class(void) php_incomplete_object_handlers.get_property_ptr_ptr = incomplete_class_get_property_ptr_ptr; php_incomplete_object_handlers.get_method = incomplete_class_get_method; - php_ce_incomplete_class = zend_register_internal_class(&incomplete_class); - php_ce_incomplete_class->ce_flags |= ZEND_ACC_FINAL; + php_ce_incomplete_class->create_object = php_create_incomplete_object; } /* }}} */ diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h index a0d81ed84e..596632d9a5 100644 --- a/ext/standard/php_assert.h +++ b/ext/standard/php_assert.h @@ -23,4 +23,6 @@ PHP_RINIT_FUNCTION(assert); PHP_RSHUTDOWN_FUNCTION(assert); PHP_MINFO_FUNCTION(assert); +extern PHPAPI zend_class_entry *assertion_error_ce; + #endif /* PHP_ASSERT_H */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index fc2caaa62c..0464358d1b 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -49,7 +49,7 @@ extern PHPAPI zend_class_entry *php_ce_incomplete_class; extern "C" { #endif -PHPAPI void php_register_incomplete_class(void); +PHPAPI void php_register_incomplete_class_handlers(void); PHPAPI zend_string *php_lookup_class_name(zend_object *object); PHPAPI void php_store_class_name(zval *object, zend_string *name); diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 6c5574f991..75cdcc734e 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -58,7 +58,7 @@ PHP_METHOD(php_user_filter, onClose) ZEND_PARSE_PARAMETERS_NONE(); } -static zend_class_entry user_filter_class_entry; +static zend_class_entry *user_filter_class_entry; static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor) { @@ -71,14 +71,8 @@ static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor) PHP_MINIT_FUNCTION(user_filters) { - zend_class_entry *php_user_filter; /* init the filter class ancestor */ - INIT_CLASS_ENTRY(user_filter_class_entry, "php_user_filter", class_php_user_filter_methods); - if ((php_user_filter = zend_register_internal_class(&user_filter_class_entry)) == NULL) { - return FAILURE; - } - zend_declare_property_string(php_user_filter, "filtername", sizeof("filtername")-1, "", ZEND_ACC_PUBLIC); - zend_declare_property_string(php_user_filter, "params", sizeof("params")-1, "", ZEND_ACC_PUBLIC); + user_filter_class_entry = register_class_php_user_filter(); /* init the filter resource; it has no dtor, as streams will always clean it up * at the correct time */ diff --git a/ext/standard/user_filters.stub.php b/ext/standard/user_filters.stub.php index 7beb014f62..2a20b88780 100755 --- a/ext/standard/user_filters.stub.php +++ b/ext/standard/user_filters.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class php_user_filter { diff --git a/ext/standard/user_filters_arginfo.h b/ext/standard/user_filters_arginfo.h index a982adbf72..2318196199 100644 --- a/ext/standard/user_filters_arginfo.h +++ b/ext/standard/user_filters_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e3ab7a87eb78ef3a7f96ad18f5dff6c6d8032ca2 */ + * Stub hash: d0653a1b2a1f33744b41a9b5f047ec4330bac091 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_filter, 0, 0, 4) ZEND_ARG_INFO(0, in) @@ -25,3 +25,25 @@ static const zend_function_entry class_php_user_filter_methods[] = { ZEND_ME(php_user_filter, onClose, arginfo_class_php_user_filter_onClose, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_php_user_filter(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "php_user_filter", class_php_user_filter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + zval property_filtername_default_value; + ZVAL_EMPTY_STRING(&property_filtername_default_value); + zend_string *property_filtername_name = zend_string_init("filtername", sizeof("filtername") - 1, 1); + zend_declare_property_ex(class_entry, property_filtername_name, &property_filtername_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_filtername_name); + + zval property_params_default_value; + ZVAL_EMPTY_STRING(&property_params_default_value); + zend_string *property_params_name = zend_string_init("params", sizeof("params") - 1, 1); + zend_declare_property_ex(class_entry, property_params_name, &property_params_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_params_name); + + return class_entry; +} diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 2a8eed34fe..c264993405 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -1147,8 +1147,6 @@ PHP_METHOD(XMLReader, expand) PHP_MINIT_FUNCTION(xmlreader) { - zend_class_entry ce; - memcpy(&xmlreader_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); xmlreader_object_handlers.offset = XtOffsetOf(xmlreader_object, std); xmlreader_object_handlers.dtor_obj = zend_objects_destroy_object; @@ -1159,9 +1157,8 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_object_handlers.get_method = xmlreader_get_method; xmlreader_object_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(ce, "XMLReader", class_XMLReader_methods); - ce.create_object = xmlreader_objects_new; - xmlreader_class_entry = zend_register_internal_class(&ce); + xmlreader_class_entry = register_class_XMLReader(); + xmlreader_class_entry->create_object = xmlreader_objects_new; memcpy(&xmlreader_open_fn, zend_hash_str_find_ptr(&xmlreader_class_entry->function_table, "open", sizeof("open")-1), sizeof(zend_internal_function)); xmlreader_open_fn.fn_flags &= ~ZEND_ACC_STATIC; diff --git a/ext/xmlreader/php_xmlreader.stub.php b/ext/xmlreader/php_xmlreader.stub.php index ecad4b392b..a551ec0deb 100644 --- a/ext/xmlreader/php_xmlreader.stub.php +++ b/ext/xmlreader/php_xmlreader.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class XMLReader { diff --git a/ext/xmlreader/php_xmlreader_arginfo.h b/ext/xmlreader/php_xmlreader_arginfo.h index 487b53f698..0c236bfe6b 100644 --- a/ext/xmlreader/php_xmlreader_arginfo.h +++ b/ext/xmlreader/php_xmlreader_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0188a53f262d3f8e19b5b64d163bdee84f1be6b8 */ + * Stub hash: 44e03e4884bd11843bae3d286a75ef1e6a677c16 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0) ZEND_END_ARG_INFO() @@ -138,3 +138,13 @@ static const zend_function_entry class_XMLReader_methods[] = { ZEND_ME(XMLReader, expand, arginfo_class_XMLReader_expand, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_XMLReader(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "XMLReader", class_XMLReader_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 6934feb77e..8c3c92849d 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -1032,16 +1032,13 @@ PHP_FUNCTION(xmlwriter_flush) /* {{{ PHP_MINIT_FUNCTION */ static PHP_MINIT_FUNCTION(xmlwriter) { - zend_class_entry ce; - memcpy(&xmlwriter_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); xmlwriter_object_handlers.offset = XtOffsetOf(ze_xmlwriter_object, std); xmlwriter_object_handlers.dtor_obj = xmlwriter_object_dtor; xmlwriter_object_handlers.free_obj = xmlwriter_object_free_storage; xmlwriter_object_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(ce, "XMLWriter", class_XMLWriter_methods); - ce.create_object = xmlwriter_object_new; - xmlwriter_class_entry_ce = zend_register_internal_class(&ce); + xmlwriter_class_entry_ce = register_class_XMLWriter(); + xmlwriter_class_entry_ce->create_object = xmlwriter_object_new; return SUCCESS; } diff --git a/ext/xmlwriter/php_xmlwriter.stub.php b/ext/xmlwriter/php_xmlwriter.stub.php index 9334545ffa..ee90003399 100644 --- a/ext/xmlwriter/php_xmlwriter.stub.php +++ b/ext/xmlwriter/php_xmlwriter.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function xmlwriter_open_uri(string $uri): XMLWriter|false {} diff --git a/ext/xmlwriter/php_xmlwriter_arginfo.h b/ext/xmlwriter/php_xmlwriter_arginfo.h index 9325ffbdb5..7547479b3b 100644 --- a/ext/xmlwriter/php_xmlwriter_arginfo.h +++ b/ext/xmlwriter/php_xmlwriter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a0ece6bc77b0a9811cb09a604b175e2295efc7a0 */ + * Stub hash: ce5cf4f922e47833033729b2a8941c36fa2b4d6d */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xmlwriter_open_uri, 0, 1, XMLWriter, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0) @@ -464,3 +464,13 @@ static const zend_function_entry class_XMLWriter_methods[] = { ZEND_ME_MAPPING(flush, xmlwriter_flush, arginfo_class_XMLWriter_flush, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_XMLWriter(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "XMLWriter", class_XMLWriter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 300b196d03..0a454039f5 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -111,16 +111,13 @@ zend_object *xsl_objects_new(zend_class_entry *class_type) /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(xsl) { - zend_class_entry ce; - memcpy(&xsl_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); xsl_object_handlers.offset = XtOffsetOf(xsl_object, std); xsl_object_handlers.clone_obj = NULL; xsl_object_handlers.free_obj = xsl_objects_free_storage; - INIT_CLASS_ENTRY(ce, "XSLTProcessor", class_XSLTProcessor_methods); - ce.create_object = xsl_objects_new; - xsl_xsltprocessor_class_entry = zend_register_internal_class(&ce); + xsl_xsltprocessor_class_entry = register_class_XSLTProcessor(); + xsl_xsltprocessor_class_entry->create_object = xsl_objects_new; #ifdef HAVE_XSL_EXSLT exsltRegisterAll(); diff --git a/ext/xsl/php_xsl.stub.php b/ext/xsl/php_xsl.stub.php index 536f82ac20..6f52e5570e 100644 --- a/ext/xsl/php_xsl.stub.php +++ b/ext/xsl/php_xsl.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class XSLTProcessor { diff --git a/ext/xsl/php_xsl_arginfo.h b/ext/xsl/php_xsl_arginfo.h index 8f7f90a053..f5be7aa731 100644 --- a/ext/xsl/php_xsl_arginfo.h +++ b/ext/xsl/php_xsl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a119247725ff61dbd615cb86ee6201ee6603ba51 */ + * Stub hash: bcc89ca2603d60a9832704809fd8ab3834e79f74 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_importStylesheet, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, stylesheet, IS_OBJECT, 0) @@ -79,3 +79,13 @@ static const zend_function_entry class_XSLTProcessor_methods[] = { ZEND_ME(XSLTProcessor, getSecurityPrefs, arginfo_class_XSLTProcessor_getSecurityPrefs, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_XSLTProcessor(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "XSLTProcessor", class_XSLTProcessor_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index fd1585d472..a3b266bba8 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -831,17 +831,12 @@ static void php_zip_register_prop_handler(HashTable *prop_handler, char *name, z { zip_prop_handler hnd; zend_string *str; - zval tmp; hnd.read_const_char_func = read_char_func; hnd.read_int_func = read_int_func; hnd.type = rettype; str = zend_string_init_interned(name, strlen(name), 1); zend_hash_add_mem(prop_handler, str, &hnd, sizeof(zip_prop_handler)); - - /* Register for reflection */ - ZVAL_NULL(&tmp); - zend_declare_property_ex(zip_class_entry, str, &tmp, ZEND_ACC_PUBLIC, NULL); zend_string_release_ex(str, 1); } /* }}} */ @@ -3026,8 +3021,6 @@ static void php_zip_free_prop_handler(zval *el) /* {{{ */ { /* {{{ PHP_MINIT_FUNCTION */ static PHP_MINIT_FUNCTION(zip) { - zend_class_entry ce; - memcpy(&zip_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); zip_object_handlers.offset = XtOffsetOf(ze_zip_object, zo); zip_object_handlers.free_obj = php_zip_object_free_storage; @@ -3039,9 +3032,8 @@ static PHP_MINIT_FUNCTION(zip) zip_object_handlers.read_property = php_zip_read_property; zip_object_handlers.has_property = php_zip_has_property; - INIT_CLASS_ENTRY(ce, "ZipArchive", class_ZipArchive_methods); - ce.create_object = php_zip_object_new; - zip_class_entry = zend_register_internal_class(&ce); + zip_class_entry = register_class_ZipArchive(zend_ce_countable); + zip_class_entry->create_object = php_zip_object_new; zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1); php_zip_register_prop_handler(&zip_prop_handlers, "lastId", php_zip_last_id, NULL, IS_LONG); @@ -3050,7 +3042,6 @@ static PHP_MINIT_FUNCTION(zip) php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, IS_LONG); php_zip_register_prop_handler(&zip_prop_handlers, "filename", NULL, php_zipobj_get_filename, IS_STRING); php_zip_register_prop_handler(&zip_prop_handlers, "comment", NULL, php_zipobj_get_zip_comment, IS_STRING); - zend_class_implements(zip_class_entry, 1, zend_ce_countable); REGISTER_ZIP_CLASS_CONST_LONG("CREATE", ZIP_CREATE); REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL); diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php index ff7b9d99fb..2c23b03851 100644 --- a/ext/zip/php_zip.stub.php +++ b/ext/zip/php_zip.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ /** * @return resource|int|false @@ -64,10 +64,25 @@ function zip_entry_filesize($zip_entry): int|false {} */ function zip_entry_compressionmethod($zip_entry): string|false {} -class ZipArchive +class ZipArchive implements Countable { + /** @var int|null */ + public $lastId; + + /** @var int|null */ + public $status; + + /** @var int|null */ + public $statusSys; + + /** @var int|null */ + public $numFiles; + + /** @var string|null */ + public $filename; + /** @var string|null */ - public $name; + public $comment; /** @return bool|int */ public function open(string $filename, int $flags = 0) {} diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h index 104fac05a0..900c334bf0 100644 --- a/ext/zip/php_zip_arginfo.h +++ b/ext/zip/php_zip_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a5b8a10dbaeddf5d0d1ac751ff64a5d7ff235562 */ + * Stub hash: a50da348df01027594efd7c8ab7427c05ffea39e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -453,3 +453,50 @@ static const zend_function_entry class_ZipArchive_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ZipArchive", class_ZipArchive_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Countable); + + zval property_lastId_default_value; + ZVAL_NULL(&property_lastId_default_value); + zend_string *property_lastId_name = zend_string_init("lastId", sizeof("lastId") - 1, 1); + zend_declare_property_ex(class_entry, property_lastId_name, &property_lastId_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_lastId_name); + + zval property_status_default_value; + ZVAL_NULL(&property_status_default_value); + zend_string *property_status_name = zend_string_init("status", sizeof("status") - 1, 1); + zend_declare_property_ex(class_entry, property_status_name, &property_status_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_status_name); + + zval property_statusSys_default_value; + ZVAL_NULL(&property_statusSys_default_value); + zend_string *property_statusSys_name = zend_string_init("statusSys", sizeof("statusSys") - 1, 1); + zend_declare_property_ex(class_entry, property_statusSys_name, &property_statusSys_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_statusSys_name); + + zval property_numFiles_default_value; + ZVAL_NULL(&property_numFiles_default_value); + zend_string *property_numFiles_name = zend_string_init("numFiles", sizeof("numFiles") - 1, 1); + zend_declare_property_ex(class_entry, property_numFiles_name, &property_numFiles_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_numFiles_name); + + zval property_filename_default_value; + ZVAL_NULL(&property_filename_default_value); + zend_string *property_filename_name = zend_string_init("filename", sizeof("filename") - 1, 1); + zend_declare_property_ex(class_entry, property_filename_name, &property_filename_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_filename_name); + + zval property_comment_default_value; + ZVAL_NULL(&property_comment_default_value); + zend_string *property_comment_name = zend_string_init("comment", sizeof("comment") - 1, 1); + zend_declare_property_ex(class_entry, property_comment_name, &property_comment_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_comment_name); + + return class_entry; +} diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 628f04f2f4..02fb4dd207 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1337,10 +1337,7 @@ static PHP_MINIT_FUNCTION(zlib) php_output_handler_conflict_register(ZEND_STRL("ob_gzhandler"), php_zlib_output_conflict_check); php_output_handler_conflict_register(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), php_zlib_output_conflict_check); - zend_class_entry inflate_ce; - INIT_CLASS_ENTRY(inflate_ce, "InflateContext", class_InflateContext_methods); - inflate_context_ce = zend_register_internal_class(&inflate_ce); - inflate_context_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + inflate_context_ce = register_class_InflateContext(); inflate_context_ce->create_object = inflate_context_create_object; inflate_context_ce->serialize = zend_class_serialize_deny; inflate_context_ce->unserialize = zend_class_unserialize_deny; @@ -1352,10 +1349,7 @@ static PHP_MINIT_FUNCTION(zlib) inflate_context_object_handlers.clone_obj = NULL; inflate_context_object_handlers.compare = zend_objects_not_comparable; - zend_class_entry deflate_ce; - INIT_CLASS_ENTRY(deflate_ce, "DeflateContext", class_DeflateContext_methods); - deflate_context_ce = zend_register_internal_class(&deflate_ce); - deflate_context_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + deflate_context_ce = register_class_DeflateContext(); deflate_context_ce->create_object = deflate_context_create_object; deflate_context_ce->serialize = zend_class_serialize_deny; deflate_context_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/zlib/zlib.stub.php b/ext/zlib/zlib.stub.php index c047a53541..1aaafcdce2 100644 --- a/ext/zlib/zlib.stub.php +++ b/ext/zlib/zlib.stub.php @@ -1,11 +1,13 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class InflateContext { } +/** @strict-properties */ final class DeflateContext { } diff --git a/ext/zlib/zlib_arginfo.h b/ext/zlib/zlib_arginfo.h index 9f5129feb0..e0ff0e16e9 100644 --- a/ext/zlib/zlib_arginfo.h +++ b/ext/zlib/zlib_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5862b97739c885589779f8ba3d13b4e390d72811 */ + * Stub hash: 1aa5f9d6d062280f6148f3e72ceeaca81fb3037e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -207,3 +207,25 @@ static const zend_function_entry class_InflateContext_methods[] = { static const zend_function_entry class_DeflateContext_methods[] = { ZEND_FE_END }; + +static zend_class_entry *register_class_InflateContext(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "InflateContext", class_InflateContext_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} + +static zend_class_entry *register_class_DeflateContext(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "DeflateContext", class_DeflateContext_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} |