Skip to content

Commit af56982

Browse files
committed
Generate class entries from stubs for oci8, odbc, openssl, pcntl, pdo, pgsql
Closes phpGH-6691
1 parent 6ce7044 commit af56982

22 files changed

+116
-49
lines changed

ext/oci8/oci8.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ static PHP_GSHUTDOWN_FUNCTION(oci)
279279

280280
PHP_MINIT_FUNCTION(oci)
281281
{
282-
zend_class_entry oci_lob_class_entry;
283-
zend_class_entry oci_coll_class_entry;
284-
285282
REGISTER_INI_ENTRIES();
286283

287284
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)
291288
le_descriptor = zend_register_list_destructors_ex(php_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number);
292289
le_collection = zend_register_list_destructors_ex(php_oci_collection_list_dtor, NULL, "oci8 collection", module_number);
293290

294-
INIT_CLASS_ENTRY(oci_lob_class_entry, "OCILob", class_OCILob_methods);
295-
INIT_CLASS_ENTRY(oci_coll_class_entry, "OCICollection", class_OCICollection_methods);
296-
297-
oci_lob_class_entry_ptr = zend_register_internal_class(&oci_lob_class_entry);
298-
oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry);
291+
oci_lob_class_entry_ptr = register_class_OCILob();
292+
oci_coll_class_entry_ptr = register_class_OCICollection();
299293

300294
/* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */
301295
REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);

ext/oci8/oci8.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
/** @param resource $statement */
66
function oci_define_by_name($statement, string $column, mixed &$var, int $type = 0): bool {}

ext/oci8/oci8_arginfo.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: e7a7a9402b2668136f9f47d6e547e3af46a78a50 */
2+
* Stub hash: f96a1c7a278551bf334eab82a69710c3418beebf */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
55
ZEND_ARG_INFO(0, statement)
@@ -789,3 +789,24 @@ static const zend_function_entry class_OCICollection_methods[] = {
789789
ZEND_ME_MAPPING(trim, oci_collection_trim, arginfo_class_OCICollection_trim, ZEND_ACC_PUBLIC)
790790
ZEND_FE_END
791791
};
792+
793+
zend_class_entry *register_class_OCILob()
794+
{
795+
zend_class_entry ce, *class_entry;
796+
797+
INIT_CLASS_ENTRY(ce, "OCILob", class_OCILob_methods);
798+
class_entry = zend_register_internal_class_ex(&ce, NULL);
799+
800+
return class_entry;
801+
}
802+
803+
zend_class_entry *register_class_OCICollection()
804+
{
805+
zend_class_entry ce, *class_entry;
806+
807+
INIT_CLASS_ENTRY(ce, "OCICollection", class_OCICollection_methods);
808+
class_entry = zend_register_internal_class_ex(&ce, NULL);
809+
810+
return class_entry;
811+
}
812+

ext/odbc/odbc.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
function odbc_close_all(): void {}
66

ext/odbc/odbc_arginfo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: dd2205269dd48e1af19c3980291b21d86fa11a93 */
2+
* Stub hash: 6d7d8d8f495236297745b9b1087e5cf955976127 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
55
ZEND_END_ARG_INFO()
@@ -375,3 +375,4 @@ static const zend_function_entry ext_functions[] = {
375375
#endif
376376
ZEND_FE_END
377377
};
378+

ext/opcache/opcache.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
function opcache_reset(): bool {}
66

ext/opcache/opcache_arginfo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 06a37b4af6a0fb5d7bd24b1660ea8ce09e959ec8 */
2+
* Stub hash: 919d85eb3f3e1127ea3911051f1d98340e84654e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_reset, 0, 0, _IS_BOOL, 0)
55
ZEND_END_ARG_INFO()
@@ -40,3 +40,4 @@ static const zend_function_entry ext_functions[] = {
4040
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
4141
ZEND_FE_END
4242
};
43+

ext/openssl/openssl.c

+3-12
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,7 @@ PHP_MINIT_FUNCTION(openssl)
11011101
{
11021102
char * config_filename;
11031103

1104-
zend_class_entry ce;
1105-
INIT_CLASS_ENTRY(ce, "OpenSSLCertificate", class_OpenSSLCertificate_methods);
1106-
php_openssl_certificate_ce = zend_register_internal_class(&ce);
1107-
php_openssl_certificate_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
1104+
php_openssl_certificate_ce = register_class_OpenSSLCertificate();
11081105
php_openssl_certificate_ce->create_object = php_openssl_certificate_create_object;
11091106
php_openssl_certificate_ce->serialize = zend_class_serialize_deny;
11101107
php_openssl_certificate_ce->unserialize = zend_class_unserialize_deny;
@@ -1115,10 +1112,7 @@ PHP_MINIT_FUNCTION(openssl)
11151112
php_openssl_certificate_object_handlers.get_constructor = php_openssl_certificate_get_constructor;
11161113
php_openssl_certificate_object_handlers.clone_obj = NULL;
11171114

1118-
zend_class_entry csr_ce;
1119-
INIT_CLASS_ENTRY(csr_ce, "OpenSSLCertificateSigningRequest", class_OpenSSLCertificateSigningRequest_methods);
1120-
php_openssl_request_ce = zend_register_internal_class(&csr_ce);
1121-
php_openssl_request_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
1115+
php_openssl_request_ce = register_class_OpenSSLCertificateSigningRequest();
11221116
php_openssl_request_ce->create_object = php_openssl_request_create_object;
11231117
php_openssl_request_ce->serialize = zend_class_serialize_deny;
11241118
php_openssl_request_ce->unserialize = zend_class_unserialize_deny;
@@ -1129,10 +1123,7 @@ PHP_MINIT_FUNCTION(openssl)
11291123
php_openssl_request_object_handlers.get_constructor = php_openssl_request_get_constructor;
11301124
php_openssl_request_object_handlers.clone_obj = NULL;
11311125

1132-
zend_class_entry key_ce;
1133-
INIT_CLASS_ENTRY(key_ce, "OpenSSLAsymmetricKey", class_OpenSSLAsymmetricKey_methods);
1134-
php_openssl_pkey_ce = zend_register_internal_class(&key_ce);
1135-
php_openssl_pkey_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
1126+
php_openssl_pkey_ce = register_class_OpenSSLAsymmetricKey();
11361127
php_openssl_pkey_ce->create_object = php_openssl_pkey_create_object;
11371128
php_openssl_pkey_ce->serialize = zend_class_serialize_deny;
11381129
php_openssl_pkey_ce->unserialize = zend_class_unserialize_deny;

ext/openssl/openssl.stub.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

5+
/** @strict-properties */
56
final class OpenSSLCertificate
67
{
78
}
89

10+
/** @strict-properties */
911
final class OpenSSLCertificateSigningRequest
1012
{
1113
}
1214

15+
/** @strict-properties */
1316
final class OpenSSLAsymmetricKey
1417
{
1518
}

ext/openssl/openssl_arginfo.h

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: d4f73f86e6f16a74ab5b60bb79c4a9f29e9bc4fb */
2+
* Stub hash: e881a9190424d49fa39ac76f6c13044b65ba2f7f */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
55
ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL)
@@ -530,3 +530,37 @@ static const zend_function_entry class_OpenSSLCertificateSigningRequest_methods[
530530
static const zend_function_entry class_OpenSSLAsymmetricKey_methods[] = {
531531
ZEND_FE_END
532532
};
533+
534+
zend_class_entry *register_class_OpenSSLCertificate()
535+
{
536+
zend_class_entry ce, *class_entry;
537+
538+
INIT_CLASS_ENTRY(ce, "OpenSSLCertificate", class_OpenSSLCertificate_methods);
539+
class_entry = zend_register_internal_class_ex(&ce, NULL);
540+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
541+
542+
return class_entry;
543+
}
544+
545+
zend_class_entry *register_class_OpenSSLCertificateSigningRequest()
546+
{
547+
zend_class_entry ce, *class_entry;
548+
549+
INIT_CLASS_ENTRY(ce, "OpenSSLCertificateSigningRequest", class_OpenSSLCertificateSigningRequest_methods);
550+
class_entry = zend_register_internal_class_ex(&ce, NULL);
551+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
552+
553+
return class_entry;
554+
}
555+
556+
zend_class_entry *register_class_OpenSSLAsymmetricKey()
557+
{
558+
zend_class_entry ce, *class_entry;
559+
560+
INIT_CLASS_ENTRY(ce, "OpenSSLAsymmetricKey", class_OpenSSLAsymmetricKey_methods);
561+
class_entry = zend_register_internal_class_ex(&ce, NULL);
562+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
563+
564+
return class_entry;
565+
}
566+

ext/pcntl/pcntl.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
function pcntl_fork(): int {}
66

ext/pcntl/pcntl_arginfo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 8742901e9b4fe5ee595a1e7c492474723f95d253 */
2+
* Stub hash: dc44f2c96c13457cd6acae4897d6e416403e6756 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0)
55
ZEND_END_ARG_INFO()
@@ -202,3 +202,4 @@ static const zend_function_entry ext_functions[] = {
202202
#endif
203203
ZEND_FE_END
204204
};
205+

ext/pcre/php_pcre.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
/** @param array $matches */
66
function preg_match(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}

ext/pcre/php_pcre_arginfo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 2e5a9edc9635edd4f5a00e9d888fb34c1746a5b8 */
2+
* Stub hash: 861429ae51cfa064e85c0c1c1972707c28869f56 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
@@ -96,3 +96,4 @@ static const zend_function_entry ext_functions[] = {
9696
ZEND_FE(preg_last_error_msg, arginfo_preg_last_error_msg)
9797
ZEND_FE_END
9898
};
99+

ext/pdo/pdo.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ PDO_API zend_string *php_pdo_int64_to_str(int64_t i64) /* {{{ */
292292
/* {{{ PHP_MINIT_FUNCTION */
293293
PHP_MINIT_FUNCTION(pdo)
294294
{
295-
zend_class_entry ce;
296-
297295
if (FAILURE == pdo_sqlstate_init_error_table()) {
298296
return FAILURE;
299297
}
@@ -303,11 +301,7 @@ PHP_MINIT_FUNCTION(pdo)
303301
le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor,
304302
"PDO persistent database", module_number);
305303

306-
INIT_CLASS_ENTRY(ce, "PDOException", class_PDOException_methods);
307-
308-
pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
309-
310-
zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC);
304+
pdo_exception_ce = register_class_PDOException(spl_ce_RuntimeException);
311305

312306
pdo_dbh_init();
313307
pdo_stmt_init();

ext/pdo/pdo.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class PDOException extends RuntimeException
66
{

ext/pdo/pdo_arginfo.h

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 68f2e4abc1071fdf8046695264de5768a8c10719 */
2+
* Stub hash: e5e41e3d0ae7a506b43996b6071047755a39d61a */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pdo_drivers, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()
@@ -17,3 +17,20 @@ static const zend_function_entry ext_functions[] = {
1717
static const zend_function_entry class_PDOException_methods[] = {
1818
ZEND_FE_END
1919
};
20+
21+
zend_class_entry *register_class_PDOException(zend_class_entry *class_entry_RuntimeException)
22+
{
23+
zend_class_entry ce, *class_entry;
24+
25+
INIT_CLASS_ENTRY(ce, "PDOException", class_PDOException_methods);
26+
class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException);
27+
28+
zval property_errorInfo_default_value;
29+
ZVAL_NULL(&property_errorInfo_default_value);
30+
zend_string *property_errorInfo_name = zend_string_init("errorInfo", sizeof("errorInfo") - 1, 1);
31+
zend_declare_property_ex(class_entry, property_errorInfo_name, &property_errorInfo_default_value, ZEND_ACC_PUBLIC, NULL);
32+
zend_string_release(property_errorInfo_name);
33+
34+
return class_entry;
35+
}
36+

ext/pdo/pdo_dbh.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -1289,10 +1289,7 @@ static void pdo_dbh_free_storage(zend_object *std);
12891289

12901290
void pdo_dbh_init(void)
12911291
{
1292-
zend_class_entry ce;
1293-
1294-
INIT_CLASS_ENTRY(ce, "PDO", class_PDO_methods);
1295-
pdo_dbh_ce = zend_register_internal_class(&ce);
1292+
pdo_dbh_ce = register_class_PDO();
12961293
pdo_dbh_ce->create_object = pdo_dbh_new;
12971294
pdo_dbh_ce->serialize = zend_class_serialize_deny;
12981295
pdo_dbh_ce->unserialize = zend_class_unserialize_deny;

ext/pdo/pdo_dbh.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class PDO
66
{

ext/pdo/pdo_dbh_arginfo.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 788d1cd616c140df4072c6e0564c2995fbdc84ad */
2+
* Stub hash: 779192c91fd281db6d2dc04143dd8656148ed789 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
@@ -92,3 +92,14 @@ static const zend_function_entry class_PDO_methods[] = {
9292
ZEND_ME(PDO, setAttribute, arginfo_class_PDO_setAttribute, ZEND_ACC_PUBLIC)
9393
ZEND_FE_END
9494
};
95+
96+
zend_class_entry *register_class_PDO()
97+
{
98+
zend_class_entry ce, *class_entry;
99+
100+
INIT_CLASS_ENTRY(ce, "PDO", class_PDO_methods);
101+
class_entry = zend_register_internal_class_ex(&ce, NULL);
102+
103+
return class_entry;
104+
}
105+

ext/pgsql/pgsql.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
/** @return resource|false */
66
function pg_connect(string $connection_string, int $flags = 0) {}

ext/pgsql/pgsql_arginfo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: de1718d3e6e66dfade25462b8461983b914120ed */
2+
* Stub hash: c88ced859b9bc6775690361d932c4cec14cb0c64 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@@ -652,3 +652,4 @@ static const zend_function_entry ext_functions[] = {
652652
ZEND_FE(pg_select, arginfo_pg_select)
653653
ZEND_FE_END
654654
};
655+

0 commit comments

Comments
 (0)