diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-14 12:00:03 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-14 23:19:21 +0100 |
commit | af56982a5ecd28291d18d2e091515ad25de1050e (patch) | |
tree | d035c514092d320ea86c34b0e670c72253603a41 | |
parent | 6ce70447ac1b83ffa64c98ddcab76f56dfb6695f (diff) | |
download | php-git-af56982a5ecd28291d18d2e091515ad25de1050e.tar.gz |
Generate class entries from stubs for oci8, odbc, openssl, pcntl, pdo, pgsql
Closes GH-6691
-rw-r--r-- | ext/oci8/oci8.c | 10 | ||||
-rw-r--r-- | ext/oci8/oci8.stub.php | 2 | ||||
-rw-r--r-- | ext/oci8/oci8_arginfo.h | 23 | ||||
-rw-r--r-- | ext/odbc/odbc.stub.php | 2 | ||||
-rw-r--r-- | ext/odbc/odbc_arginfo.h | 3 | ||||
-rw-r--r-- | ext/opcache/opcache.stub.php | 2 | ||||
-rw-r--r-- | ext/opcache/opcache_arginfo.h | 3 | ||||
-rw-r--r-- | ext/openssl/openssl.c | 15 | ||||
-rw-r--r-- | ext/openssl/openssl.stub.php | 5 | ||||
-rw-r--r-- | ext/openssl/openssl_arginfo.h | 36 | ||||
-rw-r--r-- | ext/pcntl/pcntl.stub.php | 2 | ||||
-rw-r--r-- | ext/pcntl/pcntl_arginfo.h | 3 | ||||
-rw-r--r-- | ext/pcre/php_pcre.stub.php | 2 | ||||
-rw-r--r-- | ext/pcre/php_pcre_arginfo.h | 3 | ||||
-rw-r--r-- | ext/pdo/pdo.c | 8 | ||||
-rw-r--r-- | ext/pdo/pdo.stub.php | 2 | ||||
-rw-r--r-- | ext/pdo/pdo_arginfo.h | 19 | ||||
-rw-r--r-- | ext/pdo/pdo_dbh.c | 5 | ||||
-rw-r--r-- | ext/pdo/pdo_dbh.stub.php | 2 | ||||
-rw-r--r-- | ext/pdo/pdo_dbh_arginfo.h | 13 | ||||
-rw-r--r-- | ext/pgsql/pgsql.stub.php | 2 | ||||
-rw-r--r-- | ext/pgsql/pgsql_arginfo.h | 3 |
22 files changed, 116 insertions, 49 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index c333a4d3a4..93fba39c17 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -279,9 +279,6 @@ static PHP_GSHUTDOWN_FUNCTION(oci) PHP_MINIT_FUNCTION(oci) { - zend_class_entry oci_lob_class_entry; - zend_class_entry oci_coll_class_entry; - REGISTER_INI_ENTRIES(); le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number); @@ -291,11 +288,8 @@ PHP_MINIT_FUNCTION(oci) le_descriptor = zend_register_list_destructors_ex(php_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number); le_collection = zend_register_list_destructors_ex(php_oci_collection_list_dtor, NULL, "oci8 collection", module_number); - INIT_CLASS_ENTRY(oci_lob_class_entry, "OCILob", class_OCILob_methods); - INIT_CLASS_ENTRY(oci_coll_class_entry, "OCICollection", class_OCICollection_methods); - - oci_lob_class_entry_ptr = zend_register_internal_class(&oci_lob_class_entry); - oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry); + oci_lob_class_entry_ptr = register_class_OCILob(); + oci_coll_class_entry_ptr = register_class_OCICollection(); /* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */ REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); diff --git a/ext/oci8/oci8.stub.php b/ext/oci8/oci8.stub.php index ee8ea98b54..b7d47d5dc9 100644 --- a/ext/oci8/oci8.stub.php +++ b/ext/oci8/oci8.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ /** @param resource $statement */ function oci_define_by_name($statement, string $column, mixed &$var, int $type = 0): bool {} diff --git a/ext/oci8/oci8_arginfo.h b/ext/oci8/oci8_arginfo.h index 4486036c49..db19754fe8 100644 --- a/ext/oci8/oci8_arginfo.h +++ b/ext/oci8/oci8_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e7a7a9402b2668136f9f47d6e547e3af46a78a50 */ + * Stub hash: f96a1c7a278551bf334eab82a69710c3418beebf */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0) ZEND_ARG_INFO(0, statement) @@ -789,3 +789,24 @@ static const zend_function_entry class_OCICollection_methods[] = { ZEND_ME_MAPPING(trim, oci_collection_trim, arginfo_class_OCICollection_trim, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_OCILob() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OCILob", class_OCILob_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_OCICollection() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OCICollection", class_OCICollection_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/odbc/odbc.stub.php b/ext/odbc/odbc.stub.php index e241022e10..fc19ca259f 100644 --- a/ext/odbc/odbc.stub.php +++ b/ext/odbc/odbc.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function odbc_close_all(): void {} diff --git a/ext/odbc/odbc_arginfo.h b/ext/odbc/odbc_arginfo.h index 974edf32f0..71f76f5aae 100644 --- a/ext/odbc/odbc_arginfo.h +++ b/ext/odbc/odbc_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: dd2205269dd48e1af19c3980291b21d86fa11a93 */ + * Stub hash: 6d7d8d8f495236297745b9b1087e5cf955976127 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() @@ -375,3 +375,4 @@ static const zend_function_entry ext_functions[] = { #endif ZEND_FE_END }; + diff --git a/ext/opcache/opcache.stub.php b/ext/opcache/opcache.stub.php index 34cc789717..ba65b9a264 100644 --- a/ext/opcache/opcache.stub.php +++ b/ext/opcache/opcache.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function opcache_reset(): bool {} diff --git a/ext/opcache/opcache_arginfo.h b/ext/opcache/opcache_arginfo.h index 5085255a0f..7544933231 100644 --- a/ext/opcache/opcache_arginfo.h +++ b/ext/opcache/opcache_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 06a37b4af6a0fb5d7bd24b1660ea8ce09e959ec8 */ + * Stub hash: 919d85eb3f3e1127ea3911051f1d98340e84654e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_reset, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() @@ -40,3 +40,4 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached) ZEND_FE_END }; + diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 06195004f1..3c94af9c36 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1101,10 +1101,7 @@ PHP_MINIT_FUNCTION(openssl) { char * config_filename; - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "OpenSSLCertificate", class_OpenSSLCertificate_methods); - php_openssl_certificate_ce = zend_register_internal_class(&ce); - php_openssl_certificate_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + php_openssl_certificate_ce = register_class_OpenSSLCertificate(); php_openssl_certificate_ce->create_object = php_openssl_certificate_create_object; php_openssl_certificate_ce->serialize = zend_class_serialize_deny; php_openssl_certificate_ce->unserialize = zend_class_unserialize_deny; @@ -1115,10 +1112,7 @@ PHP_MINIT_FUNCTION(openssl) php_openssl_certificate_object_handlers.get_constructor = php_openssl_certificate_get_constructor; php_openssl_certificate_object_handlers.clone_obj = NULL; - zend_class_entry csr_ce; - INIT_CLASS_ENTRY(csr_ce, "OpenSSLCertificateSigningRequest", class_OpenSSLCertificateSigningRequest_methods); - php_openssl_request_ce = zend_register_internal_class(&csr_ce); - php_openssl_request_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + php_openssl_request_ce = register_class_OpenSSLCertificateSigningRequest(); php_openssl_request_ce->create_object = php_openssl_request_create_object; php_openssl_request_ce->serialize = zend_class_serialize_deny; php_openssl_request_ce->unserialize = zend_class_unserialize_deny; @@ -1129,10 +1123,7 @@ PHP_MINIT_FUNCTION(openssl) php_openssl_request_object_handlers.get_constructor = php_openssl_request_get_constructor; php_openssl_request_object_handlers.clone_obj = NULL; - zend_class_entry key_ce; - INIT_CLASS_ENTRY(key_ce, "OpenSSLAsymmetricKey", class_OpenSSLAsymmetricKey_methods); - php_openssl_pkey_ce = zend_register_internal_class(&key_ce); - php_openssl_pkey_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + php_openssl_pkey_ce = register_class_OpenSSLAsymmetricKey(); php_openssl_pkey_ce->create_object = php_openssl_pkey_create_object; php_openssl_pkey_ce->serialize = zend_class_serialize_deny; php_openssl_pkey_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index e77f4e4043..db49af3126 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -1,15 +1,18 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ +/** @strict-properties */ final class OpenSSLCertificate { } +/** @strict-properties */ final class OpenSSLCertificateSigningRequest { } +/** @strict-properties */ final class OpenSSLAsymmetricKey { } diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 1e30d9c2c1..26e6c2d105 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d4f73f86e6f16a74ab5b60bb79c4a9f29e9bc4fb */ + * Stub hash: e881a9190424d49fa39ac76f6c13044b65ba2f7f */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) @@ -530,3 +530,37 @@ static const zend_function_entry class_OpenSSLCertificateSigningRequest_methods[ static const zend_function_entry class_OpenSSLAsymmetricKey_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_OpenSSLCertificate() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OpenSSLCertificate", class_OpenSSLCertificate_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_OpenSSLCertificateSigningRequest() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OpenSSLCertificateSigningRequest", class_OpenSSLCertificateSigningRequest_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_OpenSSLAsymmetricKey() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OpenSSLAsymmetricKey", class_OpenSSLAsymmetricKey_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/pcntl/pcntl.stub.php b/ext/pcntl/pcntl.stub.php index ea66c9f898..53c9b607ad 100644 --- a/ext/pcntl/pcntl.stub.php +++ b/ext/pcntl/pcntl.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ function pcntl_fork(): int {} diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h index 87a2579c9b..7076a19ec9 100644 --- a/ext/pcntl/pcntl_arginfo.h +++ b/ext/pcntl/pcntl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8742901e9b4fe5ee595a1e7c492474723f95d253 */ + * Stub hash: dc44f2c96c13457cd6acae4897d6e416403e6756 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -202,3 +202,4 @@ static const zend_function_entry ext_functions[] = { #endif ZEND_FE_END }; + diff --git a/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php index b2862a2f62..54cb842676 100644 --- a/ext/pcre/php_pcre.stub.php +++ b/ext/pcre/php_pcre.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ /** @param array $matches */ function preg_match(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {} diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h index c53f35559e..c92c1681ff 100644 --- a/ext/pcre/php_pcre_arginfo.h +++ b/ext/pcre/php_pcre_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2e5a9edc9635edd4f5a00e9d888fb34c1746a5b8 */ + * Stub hash: 861429ae51cfa064e85c0c1c1972707c28869f56 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -96,3 +96,4 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(preg_last_error_msg, arginfo_preg_last_error_msg) ZEND_FE_END }; + diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index b3d999bed5..a62e3f6bc3 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -292,8 +292,6 @@ PDO_API zend_string *php_pdo_int64_to_str(int64_t i64) /* {{{ */ /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(pdo) { - zend_class_entry ce; - if (FAILURE == pdo_sqlstate_init_error_table()) { return FAILURE; } @@ -303,11 +301,7 @@ PHP_MINIT_FUNCTION(pdo) le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor, "PDO persistent database", module_number); - INIT_CLASS_ENTRY(ce, "PDOException", class_PDOException_methods); - - pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException); - - zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC); + pdo_exception_ce = register_class_PDOException(spl_ce_RuntimeException); pdo_dbh_init(); pdo_stmt_init(); diff --git a/ext/pdo/pdo.stub.php b/ext/pdo/pdo.stub.php index 35404cade6..6d6d070cd7 100644 --- a/ext/pdo/pdo.stub.php +++ b/ext/pdo/pdo.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class PDOException extends RuntimeException { diff --git a/ext/pdo/pdo_arginfo.h b/ext/pdo/pdo_arginfo.h index fc9e52de9e..63343ca2aa 100644 --- a/ext/pdo/pdo_arginfo.h +++ b/ext/pdo/pdo_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 68f2e4abc1071fdf8046695264de5768a8c10719 */ + * Stub hash: e5e41e3d0ae7a506b43996b6071047755a39d61a */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pdo_drivers, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -17,3 +17,20 @@ static const zend_function_entry ext_functions[] = { static const zend_function_entry class_PDOException_methods[] = { ZEND_FE_END }; + +zend_class_entry *register_class_PDOException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "PDOException", class_PDOException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + zval property_errorInfo_default_value; + ZVAL_NULL(&property_errorInfo_default_value); + zend_string *property_errorInfo_name = zend_string_init("errorInfo", sizeof("errorInfo") - 1, 1); + zend_declare_property_ex(class_entry, property_errorInfo_name, &property_errorInfo_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_errorInfo_name); + + return class_entry; +} + diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index c1b3495a1b..3ef312cbe0 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1289,10 +1289,7 @@ static void pdo_dbh_free_storage(zend_object *std); void pdo_dbh_init(void) { - zend_class_entry ce; - - INIT_CLASS_ENTRY(ce, "PDO", class_PDO_methods); - pdo_dbh_ce = zend_register_internal_class(&ce); + pdo_dbh_ce = register_class_PDO(); pdo_dbh_ce->create_object = pdo_dbh_new; pdo_dbh_ce->serialize = zend_class_serialize_deny; pdo_dbh_ce->unserialize = zend_class_unserialize_deny; diff --git a/ext/pdo/pdo_dbh.stub.php b/ext/pdo/pdo_dbh.stub.php index adca7d6b7a..d25408db7e 100644 --- a/ext/pdo/pdo_dbh.stub.php +++ b/ext/pdo/pdo_dbh.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class PDO { diff --git a/ext/pdo/pdo_dbh_arginfo.h b/ext/pdo/pdo_dbh_arginfo.h index ac2fc76350..ae563a7399 100644 --- a/ext/pdo/pdo_dbh_arginfo.h +++ b/ext/pdo/pdo_dbh_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 788d1cd616c140df4072c6e0564c2995fbdc84ad */ + * Stub hash: 779192c91fd281db6d2dc04143dd8656148ed789 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0) @@ -92,3 +92,14 @@ static const zend_function_entry class_PDO_methods[] = { ZEND_ME(PDO, setAttribute, arginfo_class_PDO_setAttribute, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_PDO() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "PDO", class_PDO_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php index aff847bbc4..65edfd3329 100644 --- a/ext/pgsql/pgsql.stub.php +++ b/ext/pgsql/pgsql.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ /** @return resource|false */ function pg_connect(string $connection_string, int $flags = 0) {} diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index 3d9a4f2d5d..d5ebdbf29e 100644 --- a/ext/pgsql/pgsql_arginfo.h +++ b/ext/pgsql/pgsql_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: de1718d3e6e66dfade25462b8461983b914120ed */ + * Stub hash: c88ced859b9bc6775690361d932c4cec14cb0c64 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) @@ -652,3 +652,4 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(pg_select, arginfo_pg_select) ZEND_FE_END }; + |