Skip to content

Generate class entries from stubs for oci8, odbc, openssl, pcntl, pdo, pgsql #6691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ext/oci8/oci8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/oci8/oci8.stub.php
Original file line number Diff line number Diff line change
@@ -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 {}
Expand Down
23 changes: 22 additions & 1 deletion ext/oci8/oci8_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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;
}

2 changes: 1 addition & 1 deletion ext/odbc/odbc.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

function odbc_close_all(): void {}

Expand Down
3 changes: 2 additions & 1 deletion ext/odbc/odbc_arginfo.h
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -375,3 +375,4 @@ static const zend_function_entry ext_functions[] = {
#endif
ZEND_FE_END
};

2 changes: 1 addition & 1 deletion ext/opcache/opcache.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

function opcache_reset(): bool {}

Expand Down
3 changes: 2 additions & 1 deletion ext/opcache/opcache_arginfo.h
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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
};

15 changes: 3 additions & 12 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion ext/openssl/openssl.stub.php
Original file line number Diff line number Diff line change
@@ -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
{
}
Expand Down
36 changes: 35 additions & 1 deletion ext/openssl/openssl_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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;
}

2 changes: 1 addition & 1 deletion ext/pcntl/pcntl.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

function pcntl_fork(): int {}

Expand Down
3 changes: 2 additions & 1 deletion ext/pcntl/pcntl_arginfo.h
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -202,3 +202,4 @@ static const zend_function_entry ext_functions[] = {
#endif
ZEND_FE_END
};

2 changes: 1 addition & 1 deletion ext/pcre/php_pcre.stub.php
Original file line number Diff line number Diff line change
@@ -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 {}
Expand Down
3 changes: 2 additions & 1 deletion ext/pcre/php_pcre_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
};

8 changes: 1 addition & 7 deletions ext/pdo/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/pdo.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

class PDOException extends RuntimeException
{
Expand Down
19 changes: 18 additions & 1 deletion ext/pdo/pdo_arginfo.h
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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;
}

5 changes: 1 addition & 4 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/pdo_dbh.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

class PDO
{
Expand Down
13 changes: 12 additions & 1 deletion ext/pdo/pdo_dbh_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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;
}

2 changes: 1 addition & 1 deletion ext/pgsql/pgsql.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/** @generate-function-entries */
/** @generate-class-entries */

/** @return resource|false */
function pg_connect(string $connection_string, int $flags = 0) {}
Expand Down
3 changes: 2 additions & 1 deletion ext/pgsql/pgsql_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -652,3 +652,4 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pg_select, arginfo_pg_select)
ZEND_FE_END
};