diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 566197582073c..1b22ad48fbe3e 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -186,11 +186,7 @@ static void php_enchant_dict_free(zend_object *object) /* {{{ */ /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(enchant) { - zend_class_entry bce, dce; - - INIT_CLASS_ENTRY(bce, "EnchantBroker", class_EnchantBroker_methods); - enchant_broker_ce = zend_register_internal_class(&bce); - enchant_broker_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + enchant_broker_ce = register_class_EnchantBroker(); enchant_broker_ce->create_object = enchant_broker_create_object; enchant_broker_ce->serialize = zend_class_serialize_deny; enchant_broker_ce->unserialize = zend_class_unserialize_deny; @@ -200,9 +196,7 @@ PHP_MINIT_FUNCTION(enchant) enchant_broker_handlers.free_obj = php_enchant_broker_free; enchant_broker_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods); - enchant_dict_ce = zend_register_internal_class(&dce); - enchant_dict_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + enchant_dict_ce = register_class_EnchantDictionary(); enchant_dict_ce->create_object = enchant_dict_create_object; enchant_dict_ce->serialize = zend_class_serialize_deny; enchant_dict_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/enchant/enchant.stub.php b/ext/enchant/enchant.stub.php index dcd11cea38bb4..feba5d88d7e0c 100644 --- a/ext/enchant/enchant.stub.php +++ b/ext/enchant/enchant.stub.php @@ -1,11 +1,16 @@ ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} + +zend_class_entry *register_class_EnchantDictionary() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "EnchantDictionary", class_EnchantDictionary_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; +} + diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php index 9a8afe8577f3d..b277a8daad934 100644 --- a/ext/exif/exif.stub.php +++ b/ext/exif/exif.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL; + zend_ffi_parser_exception_ce = register_class_FFI_ParserException(zend_ffi_exception_ce); - INIT_CLASS_ENTRY(ce, "FFI", class_FFI_methods); - zend_ffi_ce = zend_register_internal_class(&ce); - zend_ffi_ce->ce_flags |= ZEND_ACC_FINAL; + zend_ffi_ce = register_class_FFI(); zend_ffi_ce->create_object = zend_ffi_new; zend_ffi_ce->serialize = zend_class_serialize_deny; zend_ffi_ce->unserialize = zend_class_unserialize_deny; @@ -4930,9 +4923,7 @@ ZEND_MINIT_FUNCTION(ffi) zend_declare_class_constant_long(zend_ffi_ce, "__BIGGEST_ALIGNMENT__", sizeof("__BIGGEST_ALIGNMENT__")-1, __BIGGEST_ALIGNMENT__); - INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", NULL); - zend_ffi_cdata_ce = zend_register_internal_class(&ce); - zend_ffi_cdata_ce->ce_flags |= ZEND_ACC_FINAL; + zend_ffi_cdata_ce = register_class_FFI_CData(); zend_ffi_cdata_ce->create_object = zend_ffi_cdata_new; zend_ffi_cdata_ce->get_iterator = zend_ffi_cdata_get_iterator; zend_ffi_cdata_ce->serialize = zend_class_serialize_deny; @@ -5008,9 +4999,7 @@ ZEND_MINIT_FUNCTION(ffi) zend_ffi_cdata_free_handlers.get_properties = zend_fake_get_properties; zend_ffi_cdata_free_handlers.get_gc = zend_fake_get_gc; - INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods); - zend_ffi_ctype_ce = zend_register_internal_class(&ce); - zend_ffi_ctype_ce->ce_flags |= ZEND_ACC_FINAL; + zend_ffi_ctype_ce = register_class_FFI_CType(); zend_ffi_ctype_ce->create_object = zend_ffi_ctype_new; zend_ffi_ctype_ce->serialize = zend_class_serialize_deny; zend_ffi_ctype_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php index dba2dcc308106..c86956c95f4a1 100644 --- a/ext/ffi/ffi.stub.php +++ b/ext/ffi/ffi.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + +zend_class_entry *register_class_FFI_CData() +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", class_FFI_CData_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + +zend_class_entry *register_class_FFI_CType() +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + +zend_class_entry *register_class_FFI_Exception(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", class_FFI_Exception_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + +zend_class_entry *register_class_FFI_ParserException(zend_class_entry *class_entry_FFI_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "FFI", "ParserException", class_FFI_ParserException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FFI_Exception); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 5670debe4a39d..cc272062822b2 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -107,9 +107,7 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type) /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(finfo) { - zend_class_entry _finfo_class_entry; - INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", class_finfo_methods); - finfo_class_entry = zend_register_internal_class(&_finfo_class_entry); + finfo_class_entry = register_class_finfo(); finfo_class_entry->create_object = finfo_objects_new; finfo_class_entry->serialize = zend_class_serialize_deny; finfo_class_entry->unserialize = zend_class_unserialize_deny; diff --git a/ext/fileinfo/fileinfo.stub.php b/ext/fileinfo/fileinfo.stub.php index 5a498b79c1182..cb9e639b2f5d5 100644 --- a/ext/fileinfo/fileinfo.stub.php +++ b/ext/fileinfo/fileinfo.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} + diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 2b944f04e6898..52d88fcf96b05 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -97,8 +97,6 @@ static void ftp_object_destroy(zend_object *zobj) { PHP_MINIT_FUNCTION(ftp) { - zend_class_entry ce; - #ifdef HAVE_FTP_SSL #if OPENSSL_VERSION_NUMBER < 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER) SSL_library_init(); @@ -110,9 +108,7 @@ PHP_MINIT_FUNCTION(ftp) #endif #endif - INIT_CLASS_ENTRY(ce, "FTPConnection", NULL); - php_ftp_ce = zend_register_internal_class(&ce); - php_ftp_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + php_ftp_ce = register_class_FTPConnection(); php_ftp_ce->create_object = ftp_object_create; php_ftp_ce->serialize = zend_class_serialize_deny; php_ftp_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/gd/gd.c b/ext/gd/gd.c index aecca33c8beb4..8dfb201402a21 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -217,10 +217,7 @@ void php_gd_assign_libgdimageptr_as_extgdimage(zval *val, gdImagePtr image) static void php_gd_object_minit_helper() { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "GdImage", class_GdImage_methods); - gd_image_ce = zend_register_internal_class(&ce); - gd_image_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + gd_image_ce = register_class_GdImage(); gd_image_ce->create_object = php_gd_image_object_create; gd_image_ce->serialize = zend_class_serialize_deny; gd_image_ce->unserialize = zend_class_unserialize_deny; @@ -287,10 +284,7 @@ static zend_function *php_gd_font_object_get_constructor(zend_object *object) static void php_gd_font_minit_helper() { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "GdFont", class_GdFont_methods); - gd_font_ce = zend_register_internal_class(&ce); - gd_font_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + gd_font_ce = register_class_GdFont(); gd_font_ce->create_object = php_gd_font_object_create; gd_font_ce->serialize = zend_class_serialize_deny; gd_font_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/gd/gd.stub.php b/ext/gd/gd.stub.php index 0ef410fc1e956..fdc56bc46773d 100644 --- a/ext/gd/gd.stub.php +++ b/ext/gd/gd.stub.php @@ -1,8 +1,13 @@ ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} + +zend_class_entry *register_class_GdFont() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "GdFont", class_GdFont_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; +} + diff --git a/ext/gettext/gettext.stub.php b/ext/gettext/gettext.stub.php index 84654ab741df3..7a9716361ea54 100644 --- a/ext/gettext/gettext.stub.php +++ b/ext/gettext/gettext.stub.php @@ -1,6 +1,9 @@ create_object = gmp_create_object; gmp_ce->serialize = gmp_serialize; gmp_ce->unserialize = gmp_unserialize; diff --git a/ext/gmp/gmp.stub.php b/ext/gmp/gmp.stub.php index 729ae37245aa6..77dbfef5e1b64 100644 --- a/ext/gmp/gmp.stub.php +++ b/ext/gmp/gmp.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL; + php_hashcontext_ce = register_class_HashContext(); php_hashcontext_ce->create_object = php_hashcontext_create; memcpy(&php_hashcontext_handlers, &std_object_handlers, diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php index 7eb3925c353b4..fe5516ad7e56e 100644 --- a/ext/hash/hash.stub.php +++ b/ext/hash/hash.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + diff --git a/ext/iconv/iconv.stub.php b/ext/iconv/iconv.stub.php index 84dc48a5e965f..f0d39238ff794 100644 --- a/ext/iconv/iconv.stub.php +++ b/ext/iconv/iconv.stub.php @@ -1,6 +1,9 @@ ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + php_imap_ce = register_class_IMAPConnection(); php_imap_ce->create_object = imap_object_create; php_imap_ce->serialize = zend_class_serialize_deny; php_imap_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/imap/php_imap.stub.php b/ext/imap/php_imap.stub.php index bd4b04a12142e..18495683b97d5 100644 --- a/ext/imap/php_imap.stub.php +++ b/ext/imap/php_imap.stub.php @@ -1,8 +1,12 @@ ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + + return class_entry; +} + diff --git a/ext/json/json.c b/ext/json/json.c index 872766239e0de..5315966f7d737 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -44,13 +44,9 @@ PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json) /* {{{ MINIT */ static PHP_MINIT_FUNCTION(json) { - zend_class_entry ce; + php_json_serializable_ce = register_class_JsonSerializable(); - INIT_CLASS_ENTRY(ce, "JsonSerializable", class_JsonSerializable_methods); - php_json_serializable_ce = zend_register_internal_interface(&ce); - - INIT_CLASS_ENTRY(ce, "JsonException", NULL); - php_json_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception); + php_json_exception_ce = register_class_JsonException(zend_ce_exception); /* options for json_encode */ PHP_JSON_REGISTER_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG); diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php index a9b5bbf511213..bf64f49408e16 100644 --- a/ext/json/json.stub.php +++ b/ext/json/json.stub.php @@ -1,6 +1,9 @@