diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 94a119eeec8f2..94a9502bc968c 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 6e6175a693dc6..87a530200dc00 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 abf380537ead7..6baaead27dfeb 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 5e2c1f69de7fb..6c256e7fc08fd 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 e3194efe06a8a..8c46f319b95ab 100644 --- a/ext/com_dotnet/com_extension.stub.php +++ b/ext/com_dotnet/com_extension.stub.php @@ -1,6 +1,6 @@ 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 bf0f7062fb894..2c2cc4226ea61 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 b0e9ef6b5c785..2a2b7ac5cbef1 100644 --- a/ext/com_dotnet/com_persist.stub.php +++ b/ext/com_dotnet/com_persist.stub.php @@ -1,6 +1,6 @@ ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 24e1ea646a05d..0c5fc9778f8af 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 e90209ee672d6..5c4d1cb87f1d7 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt @@ -7,14 +7,14 @@ Felix De Vliegher $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 fae6d940ba205..8b2e25fcc5a12 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 4084f5d853110..1a6326624ba2c 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 3a7e0de1743f1..83000d5b099b7 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -1,6 +1,14 @@ 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 e2b6f5bb3d9af..c75db7e45aaff 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 9904c6bc992d6..9cafa29c373a1 100755 --- a/ext/standard/dir.stub.php +++ b/ext/standard/dir.stub.php @@ -1,6 +1,6 @@ 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 a0d81ed84eee7..596632d9a5f12 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 fc2caaa62c9cb..0464358d1bf61 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 6c5574f9912e6..75cdcc734e5f7 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 7beb014f62f68..2a20b88780d36 100755 --- a/ext/standard/user_filters.stub.php +++ b/ext/standard/user_filters.stub.php @@ -1,6 +1,6 @@ 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 ecad4b392b819..a551ec0debb03 100644 --- a/ext/xmlreader/php_xmlreader.stub.php +++ b/ext/xmlreader/php_xmlreader.stub.php @@ -1,6 +1,6 @@ create_object = xmlwriter_object_new; return SUCCESS; } diff --git a/ext/xmlwriter/php_xmlwriter.stub.php b/ext/xmlwriter/php_xmlwriter.stub.php index 9334545ffae07..ee90003399b03 100644 --- a/ext/xmlwriter/php_xmlwriter.stub.php +++ b/ext/xmlwriter/php_xmlwriter.stub.php @@ -1,6 +1,6 @@ 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 536f82ac20052..6f52e5570e1e4 100644 --- a/ext/xsl/php_xsl.stub.php +++ b/ext/xsl/php_xsl.stub.php @@ -1,6 +1,6 @@ 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 ff7b9d99fbe9f..2c23b03851190 100644 --- a/ext/zip/php_zip.stub.php +++ b/ext/zip/php_zip.stub.php @@ -1,6 +1,6 @@ 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 c047a535417ef..1aaafcdce22b1 100644 --- a/ext/zlib/zlib.stub.php +++ b/ext/zlib/zlib.stub.php @@ -1,11 +1,13 @@ 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; +}