diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-15 10:00:46 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-15 11:45:26 +0100 |
commit | a730dc0cf98c8812bc8f4b4773699511e5639c06 (patch) | |
tree | 350b044edca626fe496d09407cd9f9059a18cd61 | |
parent | f01ad22bab98d20f4183d32c57f529fe5ee71828 (diff) | |
download | php-git-a730dc0cf98c8812bc8f4b4773699511e5639c06.tar.gz |
Generate class entries for snmp, soap, sockets, sodium, sqlite3, sysv*, tidy
Closes GH-6696
29 files changed, 263 insertions, 99 deletions
diff --git a/ext/skeleton/skeleton.stub.php b/ext/skeleton/skeleton.stub.php index 06740a0a78..c7907faea1 100644 --- a/ext/skeleton/skeleton.stub.php +++ b/ext/skeleton/skeleton.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function test1(): void {} diff --git a/ext/skeleton/skeleton_arginfo.h b/ext/skeleton/skeleton_arginfo.h index 9157c66bfd..8d1060c30c 100644 --- a/ext/skeleton/skeleton_arginfo.h +++ b/ext/skeleton/skeleton_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7eb3fd4083c98e6dffc8b02b6373b7ce9cbf228d */ + * Stub hash: efdd79c2c8ccff694699c86fdd6248a13839c744 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test1, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() @@ -18,3 +18,4 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(test2, arginfo_test2) ZEND_FE_END }; + diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 0f5142b28e..8674acaf21 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1959,7 +1959,6 @@ const php_snmp_prop_handler php_snmp_property_entries[] = { PHP_MINIT_FUNCTION(snmp) { netsnmp_log_handler *logh; - zend_class_entry ce, cex; init_snmp("snmpapp"); /* net-snmp corrupts the CTYPE locale during initialization. */ @@ -1985,12 +1984,11 @@ PHP_MINIT_FUNCTION(snmp) php_snmp_object_handlers.get_gc = php_snmp_get_gc; /* Register SNMP Class */ - INIT_CLASS_ENTRY(ce, "SNMP", class_SNMP_methods); - ce.create_object = php_snmp_object_new; + php_snmp_ce = register_class_SNMP(); + php_snmp_ce->create_object = php_snmp_object_new; php_snmp_object_handlers.offset = XtOffsetOf(php_snmp_object, zo); php_snmp_object_handlers.clone_obj = NULL; php_snmp_object_handlers.free_obj = php_snmp_object_free_storage; - php_snmp_ce = zend_register_internal_class(&ce); /* Register SNMP Class properties */ zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1); @@ -2035,8 +2033,7 @@ PHP_MINIT_FUNCTION(snmp) REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); /* Register SNMPException class */ - INIT_CLASS_ENTRY(cex, "SNMPException", NULL); - php_snmp_exception_ce = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException); + php_snmp_exception_ce = register_class_SNMPException(spl_ce_RuntimeException); return SUCCESS; } diff --git a/ext/snmp/snmp.stub.php b/ext/snmp/snmp.stub.php index e6e0cb22eb..1378f34ff9 100644 --- a/ext/snmp/snmp.stub.php +++ b/ext/snmp/snmp.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function snmpget(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h index 52e7e7040d..ab87cc71d6 100644 --- a/ext/snmp/snmp_arginfo.h +++ b/ext/snmp/snmp_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 32433e63feea7cc46737000498e248da713ab5a3 */ + * Stub hash: 08192d87d2ac5d35092cfcf4a2cdcc50f7ec4ada */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_snmpget, 0, 3, stdClass, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) @@ -241,3 +241,24 @@ static const zend_function_entry class_SNMP_methods[] = { static const zend_function_entry class_SNMPException_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_SNMP() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SNMP", class_SNMP_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SNMPException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SNMPException", class_SNMPException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} + diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 6466b157ce..49815082a8 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -166,13 +166,6 @@ ZEND_DECLARE_MODULE_GLOBALS(soap) static void (*old_error_handler)(int, const char *, const uint32_t, zend_string *); -#define PHP_SOAP_SERVER_CLASSNAME "SoapServer" -#define PHP_SOAP_CLIENT_CLASSNAME "SoapClient" -#define PHP_SOAP_VAR_CLASSNAME "SoapVar" -#define PHP_SOAP_FAULT_CLASSNAME "SoapFault" -#define PHP_SOAP_PARAM_CLASSNAME "SoapParam" -#define PHP_SOAP_HEADER_CLASSNAME "SoapHeader" - PHP_RINIT_FUNCTION(soap); PHP_MINIT_FUNCTION(soap); PHP_MSHUTDOWN_FUNCTION(soap); @@ -361,39 +354,27 @@ static void delete_hashtable_res(zend_resource *res) PHP_MINIT_FUNCTION(soap) { - zend_class_entry ce; - /* TODO: add ini entry for always use soap errors */ php_soap_prepare_globals(); ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, NULL); REGISTER_INI_ENTRIES(); /* Register SoapClient class */ - /* BIG NOTE : THIS EMITS AN COMPILATION WARNING UNDER ZE2 - handle_function_call deprecated. - soap_call_function_handler should be of type zend_function, not (*handle_function_call). - */ - { - INIT_CLASS_ENTRY(ce, PHP_SOAP_CLIENT_CLASSNAME, class_SoapClient_methods); - soap_class_entry = zend_register_internal_class(&ce); - } + soap_class_entry = register_class_SoapClient(); + /* Register SoapVar class */ - INIT_CLASS_ENTRY(ce, PHP_SOAP_VAR_CLASSNAME, class_SoapVar_methods); - soap_var_class_entry = zend_register_internal_class(&ce); + soap_var_class_entry = register_class_SoapVar(); /* Register SoapServer class */ - INIT_CLASS_ENTRY(ce, PHP_SOAP_SERVER_CLASSNAME, class_SoapServer_methods); - soap_server_class_entry = zend_register_internal_class(&ce); + soap_server_class_entry = register_class_SoapServer(); /* Register SoapFault class */ - INIT_CLASS_ENTRY(ce, PHP_SOAP_FAULT_CLASSNAME, class_SoapFault_methods); - soap_fault_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); + soap_fault_class_entry = register_class_SoapFault(zend_ce_exception); /* Register SoapParam class */ - INIT_CLASS_ENTRY(ce, PHP_SOAP_PARAM_CLASSNAME, class_SoapParam_methods); - soap_param_class_entry = zend_register_internal_class(&ce); + soap_param_class_entry = register_class_SoapParam(); - INIT_CLASS_ENTRY(ce, PHP_SOAP_HEADER_CLASSNAME, class_SoapHeader_methods); - soap_header_class_entry = zend_register_internal_class(&ce); + soap_header_class_entry = register_class_SoapHeader(); le_sdl = zend_register_list_destructors_ex(delete_sdl_res, NULL, "SOAP SDL", module_number); le_url = zend_register_list_destructors_ex(delete_url_res, NULL, "SOAP URL", module_number); diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php index 01e41b7e87..1e92dca751 100644 --- a/ext/soap/soap.stub.php +++ b/ext/soap/soap.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function use_soap_error_handler(bool $enable = true): bool {} diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h index da80ca6fdf..06dce3c891 100644 --- a/ext/soap/soap_arginfo.h +++ b/ext/soap/soap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c0d32b2d8f3c39203b437a01dc79cd4e934dc9f7 */ + * Stub hash: b4f2354707bc7b992a3574f820edb329b16dd49e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 0, "true") @@ -230,3 +230,64 @@ static const zend_function_entry class_SoapClient_methods[] = { ZEND_ME(SoapClient, __setLocation, arginfo_class_SoapClient___setLocation, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_SoapParam() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapParam", class_SoapParam_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SoapHeader() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapHeader", class_SoapHeader_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SoapFault(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapFault", class_SoapFault_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + +zend_class_entry *register_class_SoapVar() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapVar", class_SoapVar_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SoapServer() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapServer", class_SoapServer_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SoapClient() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SoapClient", class_SoapClient_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 4675615973..204fa98a47 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -432,10 +432,7 @@ static PHP_MINIT_FUNCTION(sockets) ZEND_TSRMLS_CACHE_UPDATE(); #endif - zend_class_entry ce_socket; - INIT_CLASS_ENTRY(ce_socket, "Socket", class_Socket_methods); - socket_ce = zend_register_internal_class(&ce_socket); - socket_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + socket_ce = register_class_Socket(); socket_ce->create_object = socket_create_object; socket_ce->serialize = zend_class_serialize_deny; socket_ce->unserialize = zend_class_unserialize_deny; @@ -447,10 +444,7 @@ static PHP_MINIT_FUNCTION(sockets) socket_object_handlers.clone_obj = NULL; socket_object_handlers.get_gc = socket_get_gc; - zend_class_entry ce_address_info; - INIT_CLASS_ENTRY(ce_address_info, "AddressInfo", class_AddressInfo_methods); - address_info_ce = zend_register_internal_class(&ce_address_info); - address_info_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + address_info_ce = register_class_AddressInfo(); address_info_ce->create_object = address_info_create_object; address_info_ce->serialize = zend_class_serialize_deny; address_info_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php index b345163bc7..967041e98e 100644 --- a/ext/sockets/sockets.stub.php +++ b/ext/sockets/sockets.stub.php @@ -1,11 +1,13 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class Socket { } +/** @strict-properties */ final class AddressInfo { } diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index 343c19a563..6985fc1f8a 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 90c3c470833947859433a2668d328fddfff94ae9 */ + * Stub hash: aed25e8e90959fde6a454cf3b8d648feaf0ebad7 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) @@ -321,3 +321,26 @@ static const zend_function_entry class_Socket_methods[] = { static const zend_function_entry class_AddressInfo_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_Socket() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Socket", class_Socket_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; +} + +zend_class_entry *register_class_AddressInfo() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "AddressInfo", class_AddressInfo_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/sodium/libsodium.c b/ext/sodium/libsodium.c index bbe88ba206..7cdae32468 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -129,14 +129,11 @@ static void sodium_separate_string(zval *zv) { PHP_MINIT_FUNCTION(sodium) { - zend_class_entry ce; - if (sodium_init() < 0) { zend_error(E_ERROR, "sodium_init()"); } - INIT_CLASS_ENTRY(ce, "SodiumException", NULL); - sodium_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception); + sodium_exception_ce = register_class_SodiumException(zend_ce_exception); sodium_exception_ce->create_object = sodium_exception_create_object; REGISTER_STRING_CONSTANT("SODIUM_LIBRARY_VERSION", diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php index e8f7b54ca2..a4029d04d0 100644 --- a/ext/sodium/libsodium.stub.php +++ b/ext/sodium/libsodium.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function sodium_crypto_aead_aes256gcm_is_available(): bool {} diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h index 07b78aba74..aee45a5e6e 100644 --- a/ext/sodium/libsodium_arginfo.h +++ b/ext/sodium/libsodium_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b34401e98646f1e85a8dd292477cac68c6e4ac97 */ + * Stub hash: 457c4c5a0243f815d859bdc9728709b4a8dc84d7 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() @@ -666,3 +666,14 @@ static const zend_function_entry ext_functions[] = { static const zend_function_entry class_SodiumException_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_SodiumException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SodiumException", class_SodiumException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index cfd0cb7eae..1db9841252 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2332,8 +2332,6 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */ /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(sqlite3) { - zend_class_entry ce; - #ifdef ZTS /* Refuse to load if this wasn't a threasafe library loaded */ if (!sqlite3_threadsafe()) { @@ -2347,32 +2345,29 @@ PHP_MINIT_FUNCTION(sqlite3) memcpy(&sqlite3_result_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); /* Register SQLite 3 Class */ - INIT_CLASS_ENTRY(ce, "SQLite3", class_SQLite3_methods); - ce.create_object = php_sqlite3_object_new; sqlite3_object_handlers.offset = XtOffsetOf(php_sqlite3_db_object, zo); sqlite3_object_handlers.clone_obj = NULL; sqlite3_object_handlers.free_obj = php_sqlite3_object_free_storage; - php_sqlite3_sc_entry = zend_register_internal_class(&ce); + php_sqlite3_sc_entry = register_class_SQLite3(); + php_sqlite3_sc_entry->create_object = php_sqlite3_object_new; php_sqlite3_sc_entry->serialize = zend_class_serialize_deny; php_sqlite3_sc_entry->unserialize = zend_class_unserialize_deny; /* Register SQLite 3 Prepared Statement Class */ - INIT_CLASS_ENTRY(ce, "SQLite3Stmt", class_SQLite3Stmt_methods); - ce.create_object = php_sqlite3_stmt_object_new; sqlite3_stmt_object_handlers.offset = XtOffsetOf(php_sqlite3_stmt, zo); sqlite3_stmt_object_handlers.clone_obj = NULL; sqlite3_stmt_object_handlers.free_obj = php_sqlite3_stmt_object_free_storage; - php_sqlite3_stmt_entry = zend_register_internal_class(&ce); + php_sqlite3_stmt_entry = register_class_SQLite3Stmt(); + php_sqlite3_stmt_entry->create_object = php_sqlite3_stmt_object_new; php_sqlite3_stmt_entry->serialize = zend_class_serialize_deny; php_sqlite3_stmt_entry->unserialize = zend_class_unserialize_deny; /* Register SQLite 3 Result Class */ - INIT_CLASS_ENTRY(ce, "SQLite3Result", class_SQLite3Result_methods); - ce.create_object = php_sqlite3_result_object_new; sqlite3_result_object_handlers.offset = XtOffsetOf(php_sqlite3_result, zo); sqlite3_result_object_handlers.clone_obj = NULL; sqlite3_result_object_handlers.free_obj = php_sqlite3_result_object_free_storage; - php_sqlite3_result_entry = zend_register_internal_class(&ce); + php_sqlite3_result_entry = register_class_SQLite3Result(); + php_sqlite3_result_entry->create_object = php_sqlite3_result_object_new; php_sqlite3_result_entry->serialize = zend_class_serialize_deny; php_sqlite3_result_entry->unserialize = zend_class_unserialize_deny; diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php index b4d4fdce29..37776aea66 100644 --- a/ext/sqlite3/sqlite3.stub.php +++ b/ext/sqlite3/sqlite3.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class SQLite3 { diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h index 8f95c54d8f..480f18a860 100644 --- a/ext/sqlite3/sqlite3_arginfo.h +++ b/ext/sqlite3/sqlite3_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2abe77016e7a595f1687be34e52bba6aa477e7ae */ + * Stub hash: edb21146ffbfccc998f922f9e6967738134b8b07 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -254,3 +254,34 @@ static const zend_function_entry class_SQLite3Result_methods[] = { ZEND_ME(SQLite3Result, finalize, arginfo_class_SQLite3Result_finalize, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_SQLite3() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SQLite3", class_SQLite3_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SQLite3Stmt() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SQLite3Stmt", class_SQLite3Stmt_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_SQLite3Result() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SQLite3Result", class_SQLite3Result_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index 8f24d7e017..c9764726d4 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -108,10 +108,7 @@ static void sysvmsg_queue_free_obj(zend_object *object) /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(sysvmsg) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "SysvMessageQueue", class_SysvMessageQueue_methods); - sysvmsg_queue_ce = zend_register_internal_class(&ce); - sysvmsg_queue_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + sysvmsg_queue_ce = register_class_SysvMessageQueue(); sysvmsg_queue_ce->create_object = sysvmsg_queue_create_object; sysvmsg_queue_ce->serialize = zend_class_serialize_deny; sysvmsg_queue_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/sysvmsg/sysvmsg.stub.php b/ext/sysvmsg/sysvmsg.stub.php index 2a0c9cdc95..5ec72a4837 100644 --- a/ext/sysvmsg/sysvmsg.stub.php +++ b/ext/sysvmsg/sysvmsg.stub.php @@ -1,7 +1,8 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class SysvMessageQueue { } diff --git a/ext/sysvmsg/sysvmsg_arginfo.h b/ext/sysvmsg/sysvmsg_arginfo.h index 804f1768b3..4759718b66 100644 --- a/ext/sysvmsg/sysvmsg_arginfo.h +++ b/ext/sysvmsg/sysvmsg_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3f918caddccfebee1f1048abd4a23672724436ad */ + * Stub hash: 6744b81ba4b0b5db62ffe04255c35519e17be7c2 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_msg_get_queue, 0, 1, SysvMessageQueue, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0) @@ -68,3 +68,15 @@ static const zend_function_entry ext_functions[] = { static const zend_function_entry class_SysvMessageQueue_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_SysvMessageQueue() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SysvMessageQueue", class_SysvMessageQueue_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/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index 46116e212e..7009ad0fac 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -151,10 +151,7 @@ static void sysvsem_free_obj(zend_object *object) /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(sysvsem) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "SysvSemaphore", class_SysvSemaphore_methods); - sysvsem_ce = zend_register_internal_class(&ce); - sysvsem_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + sysvsem_ce = register_class_SysvSemaphore(); sysvsem_ce->create_object = sysvsem_create_object; sysvsem_ce->serialize = zend_class_serialize_deny; sysvsem_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/sysvsem/sysvsem.stub.php b/ext/sysvsem/sysvsem.stub.php index 8da71b09fb..40cb9b5d3e 100644 --- a/ext/sysvsem/sysvsem.stub.php +++ b/ext/sysvsem/sysvsem.stub.php @@ -1,7 +1,8 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class SysvSemaphore { } diff --git a/ext/sysvsem/sysvsem_arginfo.h b/ext/sysvsem/sysvsem_arginfo.h index 8d6f0ac409..a4080bef5b 100644 --- a/ext/sysvsem/sysvsem_arginfo.h +++ b/ext/sysvsem/sysvsem_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 745e7cf135c7d1c9ad09d1ea1ab6cf2a8181433a */ + * Stub hash: dd7be82f586ef5f9221268ae90e959e8cccdcacf */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_sem_get, 0, 1, SysvSemaphore, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0) @@ -38,3 +38,15 @@ static const zend_function_entry ext_functions[] = { static const zend_function_entry class_SysvSemaphore_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_SysvSemaphore() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SysvSemaphore", class_SysvSemaphore_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/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index 96b437b419..9ababdb8fe 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -99,10 +99,7 @@ static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos); /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(sysvshm) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "SysvSharedMemory", class_SysvSharedMemory_methods); - sysvshm_ce = zend_register_internal_class(&ce); - sysvshm_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + sysvshm_ce = register_class_SysvSharedMemory(); sysvshm_ce->create_object = sysvshm_create_object; sysvshm_ce->serialize = zend_class_serialize_deny; sysvshm_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/sysvshm/sysvshm.stub.php b/ext/sysvshm/sysvshm.stub.php index 4f2799a349..d874435b06 100644 --- a/ext/sysvshm/sysvshm.stub.php +++ b/ext/sysvshm/sysvshm.stub.php @@ -1,7 +1,8 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class SysvSharedMemory { } diff --git a/ext/sysvshm/sysvshm_arginfo.h b/ext/sysvshm/sysvshm_arginfo.h index d6f09d1426..44a3f6c569 100644 --- a/ext/sysvshm/sysvshm_arginfo.h +++ b/ext/sysvshm/sysvshm_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 12f78387e5b7c436b608dbecc4c6b3eec82b6db1 */ + * Stub hash: 033437611b589798fe9771e6dd2e95d2fbc999d4 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_shm_attach, 0, 1, SysvSharedMemory, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0) @@ -56,3 +56,15 @@ static const zend_function_entry ext_functions[] = { static const zend_function_entry class_SysvSharedMemory_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_SysvSharedMemory() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SysvSharedMemory", class_SysvSharedMemory_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/tidy/tidy.c b/ext/tidy/tidy.c index ad2059c4e0..561ece618b 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -89,16 +89,6 @@ } \ } -#define REGISTER_TIDY_CLASS(classname, name, parent, __flags) \ - { \ - zend_class_entry ce; \ - INIT_CLASS_ENTRY(ce, # classname, class_ ## classname ## _methods); \ - ce.create_object = tidy_object_new_ ## name; \ - tidy_ce_ ## name = zend_register_internal_class_ex(&ce, parent); \ - tidy_ce_ ## name->ce_flags |= __flags; \ - memcpy(&tidy_object_handlers_ ## name, &std_object_handlers, sizeof(zend_object_handlers)); \ - tidy_object_handlers_ ## name.clone_obj = NULL; \ - } #define TIDY_TAG_CONST(tag) REGISTER_LONG_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) #define TIDY_NODE_CONST(name, type) REGISTER_LONG_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) @@ -826,8 +816,16 @@ static PHP_MINIT_FUNCTION(tidy) tidySetPanicCall(php_tidy_panic); REGISTER_INI_ENTRIES(); - REGISTER_TIDY_CLASS(tidy, doc, NULL, 0); - REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL); + + tidy_ce_doc = register_class_tidy(); + tidy_ce_doc->create_object = tidy_object_new_doc; + memcpy(&tidy_object_handlers_doc, &std_object_handlers, sizeof(zend_object_handlers)); + tidy_object_handlers_doc.clone_obj = NULL; + + tidy_ce_node = register_class_tidyNode(); + tidy_ce_node->create_object = tidy_object_new_node; + memcpy(&tidy_object_handlers_node, &std_object_handlers, sizeof(zend_object_handlers)); + tidy_object_handlers_node.clone_obj = NULL; tidy_object_handlers_doc.cast_object = tidy_doc_cast_handler; tidy_object_handlers_node.cast_object = tidy_node_cast_handler; diff --git a/ext/tidy/tidy.stub.php b/ext/tidy/tidy.stub.php index 4030fa954d..74867f6cd7 100644 --- a/ext/tidy/tidy.stub.php +++ b/ext/tidy/tidy.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function tidy_parse_string(string $string, array|string|null $config = null, ?string $encoding = null): tidy|false {} diff --git a/ext/tidy/tidy_arginfo.h b/ext/tidy/tidy_arginfo.h index 45f824865b..f63cdac4a5 100644 --- a/ext/tidy/tidy_arginfo.h +++ b/ext/tidy/tidy_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c4bbc901ca156da7cf0cbcc3c4019c7d3886959f */ + * Stub hash: 75995fe0aad02540f1bde99495a188ae4ab7c0ac */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_string, 0, 1, tidy, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) @@ -281,3 +281,25 @@ static const zend_function_entry class_tidyNode_methods[] = { ZEND_ME(tidyNode, getParent, arginfo_class_tidyNode_getParent, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_tidy() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "tidy", class_tidy_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_tidyNode() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "tidyNode", class_tidyNode_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} + |