Skip to content

Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend #6706

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 5 commits 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
5 changes: 1 addition & 4 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
/* }}} */

ZEND_MINIT_FUNCTION(core) { /* {{{ */
zend_class_entry class_entry;

INIT_CLASS_ENTRY(class_entry, "stdClass", NULL);
zend_standard_class_def = zend_register_internal_class(&class_entry);
zend_standard_class_def = register_class_stdClass();

zend_register_default_classes();

Expand Down
4 changes: 4 additions & 0 deletions Zend/zend_builtin_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

/** @generate-class-entries */

class stdClass
{
}

function zend_version(): string {}

function func_num_args(): int {}
Expand Down
17 changes: 16 additions & 1 deletion Zend/zend_builtin_functions_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: b2216a294367f50c8b6208653ebf6fa43dc106d1 */
* Stub hash: 429fc9b22054348101d0b9d6746494e52dc04edf */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -333,3 +333,18 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(gc_status, arginfo_gc_status)
ZEND_FE_END
};


static const zend_function_entry class_stdClass_methods[] = {
ZEND_FE_END
};

static zend_class_entry *register_class_stdClass(void)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "stdClass", class_stdClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);

return class_entry;
}
25 changes: 9 additions & 16 deletions ext/com_dotnet/com_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,40 +159,33 @@ static PHP_GINIT_FUNCTION(com_dotnet)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(com_dotnet)
{
zend_class_entry ce, *tmp;
zend_class_entry *tmp;

php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU);
php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);

INIT_CLASS_ENTRY(ce, "com_exception", NULL);
php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception);
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
php_com_exception_class_entry = register_class_com_exception(zend_ce_exception);
/* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */

INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
php_com_saproxy_class_entry = zend_register_internal_class(&ce);
php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
php_com_saproxy_class_entry = register_class_com_safearray_proxy();
/* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;

INIT_CLASS_ENTRY(ce, "variant", class_variant_methods);
ce.create_object = php_com_object_new;
php_com_variant_class_entry = zend_register_internal_class(&ce);
php_com_variant_class_entry = register_class_variant();
php_com_variant_class_entry->create_object = php_com_object_new;
php_com_variant_class_entry->get_iterator = php_com_iter_get;
php_com_variant_class_entry->serialize = zend_class_serialize_deny;
php_com_variant_class_entry->unserialize = zend_class_unserialize_deny;

INIT_CLASS_ENTRY(ce, "com", class_com_methods);
ce.create_object = php_com_object_new;
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
tmp = register_class_com(php_com_variant_class_entry);
tmp->create_object = php_com_object_new;
tmp->get_iterator = php_com_iter_get;
tmp->serialize = zend_class_serialize_deny;
tmp->unserialize = zend_class_unserialize_deny;

#if HAVE_MSCOREE_H
INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods);
ce.create_object = php_com_object_new;
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
tmp = register_class_dotnet(php_com_variant_class_entry);
tmp->create_object = php_com_object_new;
tmp->get_iterator = php_com_iter_get;
tmp->serialize = zend_class_serialize_deny;
tmp->unserialize = zend_class_unserialize_deny;
Expand Down
12 changes: 8 additions & 4 deletions ext/com_dotnet/com_extension.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

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

function variant_set(variant $variant, mixed $value): void {}

Expand Down Expand Up @@ -71,18 +71,22 @@ class variant
public function __construct(mixed $value = null, int $type = VT_EMPTY, int $codepage = CP_ACP) {}
}

class com
class com extends variant
{
public function __construct(string $module_name, array|string|null $server_name = null, int $codepage = CP_ACP, string $typelib = "") {}
}

#if HAVE_MSCOREE_H
class dotnet
class dotnet extends variant
{
public function __construct(string $assembly_name, string $datatype_name, int $codepage = CP_ACP) {}
}
#endif

final class com_exception extends exception
final class com_safearray_proxy
{
}

final class com_exception extends Exception
{
}
59 changes: 58 additions & 1 deletion ext/com_dotnet/com_extension_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: 6b162963bcceb90144fdd3165137fb567f916812 */
* Stub hash: ba77cee0a718bcbe7ac280f07a41f9e97a8e2246 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
Expand Down Expand Up @@ -228,6 +228,63 @@ static const zend_function_entry class_dotnet_methods[] = {
};


static const zend_function_entry class_com_safearray_proxy_methods[] = {
ZEND_FE_END
};


static const zend_function_entry class_com_exception_methods[] = {
ZEND_FE_END
};

static zend_class_entry *register_class_variant(void)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "variant", class_variant_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);

return class_entry;
}

static zend_class_entry *register_class_com(zend_class_entry *class_entry_variant)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "com", class_com_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_variant);

return class_entry;
}

static zend_class_entry *register_class_dotnet(zend_class_entry *class_entry_variant)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_variant);

return class_entry;
}

static zend_class_entry *register_class_com_safearray_proxy(void)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "com_safearray_proxy", class_com_safearray_proxy_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

static zend_class_entry *register_class_com_exception(zend_class_entry *class_entry_Exception)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "com_exception", class_com_exception_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}
8 changes: 2 additions & 6 deletions ext/com_dotnet/com_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,16 +721,12 @@ static zend_object* helper_new(zend_class_entry *ce)

int php_com_persist_minit(INIT_FUNC_ARGS)
{
zend_class_entry ce;

memcpy(&helper_handlers, &std_object_handlers, sizeof(helper_handlers));
helper_handlers.free_obj = helper_free_storage;
helper_handlers.clone_obj = helper_clone;

INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods);
ce.create_object = helper_new;
helper_ce = zend_register_internal_class(&ce);
helper_ce->ce_flags |= ZEND_ACC_FINAL;
helper_ce = register_class_COMPersistHelper();
helper_ce->create_object = helper_new;

le_istream = zend_register_list_destructors_ex(istream_dtor,
NULL, "com_dotnet_istream_wrapper", module_number);
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_persist.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

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

final class COMPersistHelper
{
Expand Down
13 changes: 12 additions & 1 deletion ext/com_dotnet/com_persist_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: 2c2759e6c1894713439e3ee8da7f56810d00d8cf */
* Stub hash: d14d30fb232f08da37ba0df0b9186eb8bac5e1a4 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_COMPersistHelper___construct, 0, 0, 0)
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, variant, variant, 1, "null")
Expand Down Expand Up @@ -52,3 +52,14 @@ static const zend_function_entry class_COMPersistHelper_methods[] = {
ZEND_ME(COMPersistHelper, SaveToStream, arginfo_class_COMPersistHelper_SaveToStream, ZEND_ACC_PUBLIC)
ZEND_FE_END
};

static zend_class_entry *register_class_COMPersistHelper(void)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}
5 changes: 0 additions & 5 deletions ext/dom/php_dom.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc);
void dom_parent_node_before(dom_object *context, zval *nodes, int nodesc);
void dom_child_node_remove(dom_object *context);

#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
ce.create_object = dom_objects_new; \
entry = zend_register_internal_class_ex(&ce, parent_ce);

#define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
__intern = Z_DOMOBJ_P(__id); \
if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Felix De Vliegher <felix.devliegher@gmail.com>
$standard = new ReflectionExtension('standard');
var_dump($standard->getClassNames());
?>
--EXPECTF--
--EXPECT--
array(4) {
[0]=>
%s(22) "__PHP_Incomplete_Class"
string(22) "__PHP_Incomplete_Class"
[1]=>
%s(15) "php_user_filter"
string(14) "AssertionError"
[2]=>
%s(9) "Directory"
string(15) "php_user_filter"
[3]=>
%s(14) "AssertionError"
string(9) "Directory"
}
9 changes: 2 additions & 7 deletions ext/standard/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ ZEND_END_MODULE_GLOBALS(assert)

ZEND_DECLARE_MODULE_GLOBALS(assert)

static zend_class_entry *assertion_error_ce;

#define ASSERTG(v) ZEND_MODULE_GLOBALS_ACCESSOR(assert, v)

#define SAFE_STRING(s) ((s)?(s):"")
Expand All @@ -46,6 +44,8 @@ enum {
ASSERT_EXCEPTION
};

PHPAPI zend_class_entry *assertion_error_ce;

static PHP_INI_MH(OnChangeCallback) /* {{{ */
{
if (EG(current_execute_data)) {
Expand Down Expand Up @@ -89,8 +89,6 @@ static void php_assert_init_globals(zend_assert_globals *assert_globals_p) /* {{

PHP_MINIT_FUNCTION(assert) /* {{{ */
{
zend_class_entry ce;

ZEND_INIT_MODULE_GLOBALS(assert, php_assert_init_globals, NULL);

REGISTER_INI_ENTRIES();
Expand All @@ -101,9 +99,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT);

INIT_CLASS_ENTRY(ce, "AssertionError", NULL);
assertion_error_ce = zend_register_internal_class_ex(&ce, zend_ce_error);

return SUCCESS;
}
/* }}} */
Expand Down
5 changes: 4 additions & 1 deletion ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
#endif
#endif

php_register_incomplete_class();
php_ce_incomplete_class = register_class___PHP_Incomplete_Class();
php_register_incomplete_class_handlers();

assertion_error_ce = register_class_AssertionError(zend_ce_error);

REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT);
Expand Down
10 changes: 9 additions & 1 deletion ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?php

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

final class __PHP_Incomplete_Class
{
}

class AssertionError extends Error
{
}

/* main/main.c */

Expand Down
33 changes: 32 additions & 1 deletion ext/standard/basic_functions_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: e9f39cbc595f0f2cdd84e58d4857f9fdb03ff7b7 */
* Stub hash: 97edf8c87780c892984099e52ad1c6c745b919f8 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
Expand Down Expand Up @@ -3491,3 +3491,34 @@ static const zend_function_entry ext_functions[] = {
#endif
ZEND_FE_END
};


static const zend_function_entry class___PHP_Incomplete_Class_methods[] = {
ZEND_FE_END
};


static const zend_function_entry class_AssertionError_methods[] = {
ZEND_FE_END
};

static zend_class_entry *register_class___PHP_Incomplete_Class(void)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "__PHP_Incomplete_Class", class___PHP_Incomplete_Class_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

static zend_class_entry *register_class_AssertionError(zend_class_entry *class_entry_Error)
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "AssertionError", class_AssertionError_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);

return class_entry;
}
Loading