Skip to content

Commit 7585b07

Browse files
committed
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
1 parent 803779e commit 7585b07

39 files changed

+357
-113
lines changed

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
/* }}} */
3333

3434
ZEND_MINIT_FUNCTION(core) { /* {{{ */
35-
zend_class_entry class_entry;
36-
37-
INIT_CLASS_ENTRY(class_entry, "stdClass", NULL);
38-
zend_standard_class_def = zend_register_internal_class(&class_entry);
35+
zend_standard_class_def = register_class_stdClass();
3936

4037
zend_register_default_classes();
4138

Zend/zend_builtin_functions.stub.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
/** @generate-class-entries */
44

5+
class stdClass
6+
{
7+
}
8+
59
function zend_version(): string {}
610

711
function func_num_args(): int {}

Zend/zend_builtin_functions_arginfo.h

Lines changed: 16 additions & 1 deletion
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: b2216a294367f50c8b6208653ebf6fa43dc106d1 */
2+
* Stub hash: 429fc9b22054348101d0b9d6746494e52dc04edf */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()
@@ -333,3 +333,18 @@ static const zend_function_entry ext_functions[] = {
333333
ZEND_FE(gc_status, arginfo_gc_status)
334334
ZEND_FE_END
335335
};
336+
337+
338+
static const zend_function_entry class_stdClass_methods[] = {
339+
ZEND_FE_END
340+
};
341+
342+
static zend_class_entry *register_class_stdClass(void)
343+
{
344+
zend_class_entry ce, *class_entry;
345+
346+
INIT_CLASS_ENTRY(ce, "stdClass", class_stdClass_methods);
347+
class_entry = zend_register_internal_class_ex(&ce, NULL);
348+
349+
return class_entry;
350+
}

ext/com_dotnet/com_extension.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,40 +159,33 @@ static PHP_GINIT_FUNCTION(com_dotnet)
159159
/* {{{ PHP_MINIT_FUNCTION */
160160
PHP_MINIT_FUNCTION(com_dotnet)
161161
{
162-
zend_class_entry ce, *tmp;
162+
zend_class_entry *tmp;
163163

164164
php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU);
165165
php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);
166166

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

172-
INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
173-
php_com_saproxy_class_entry = zend_register_internal_class(&ce);
174-
php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
170+
php_com_saproxy_class_entry = register_class_com_safearray_proxy();
175171
/* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
176172
php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
177173

178-
INIT_CLASS_ENTRY(ce, "variant", class_variant_methods);
179-
ce.create_object = php_com_object_new;
180-
php_com_variant_class_entry = zend_register_internal_class(&ce);
174+
php_com_variant_class_entry = register_class_variant();
175+
php_com_variant_class_entry->create_object = php_com_object_new;
181176
php_com_variant_class_entry->get_iterator = php_com_iter_get;
182177
php_com_variant_class_entry->serialize = zend_class_serialize_deny;
183178
php_com_variant_class_entry->unserialize = zend_class_unserialize_deny;
184179

185-
INIT_CLASS_ENTRY(ce, "com", class_com_methods);
186-
ce.create_object = php_com_object_new;
187-
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
180+
tmp = register_class_com(php_com_variant_class_entry);
181+
tmp->create_object = php_com_object_new;
188182
tmp->get_iterator = php_com_iter_get;
189183
tmp->serialize = zend_class_serialize_deny;
190184
tmp->unserialize = zend_class_unserialize_deny;
191185

192186
#if HAVE_MSCOREE_H
193-
INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods);
194-
ce.create_object = php_com_object_new;
195-
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
187+
tmp = register_class_dotnet(php_com_variant_class_entry);
188+
tmp->create_object = php_com_object_new;
196189
tmp->get_iterator = php_com_iter_get;
197190
tmp->serialize = zend_class_serialize_deny;
198191
tmp->unserialize = zend_class_unserialize_deny;

ext/com_dotnet/com_extension.stub.php

Lines changed: 8 additions & 4 deletions
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 variant_set(variant $variant, mixed $value): void {}
66

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

74-
class com
74+
class com extends variant
7575
{
7676
public function __construct(string $module_name, array|string|null $server_name = null, int $codepage = CP_ACP, string $typelib = "") {}
7777
}
7878

7979
#if HAVE_MSCOREE_H
80-
class dotnet
80+
class dotnet extends variant
8181
{
8282
public function __construct(string $assembly_name, string $datatype_name, int $codepage = CP_ACP) {}
8383
}
8484
#endif
8585

86-
final class com_exception extends exception
86+
final class com_safearray_proxy
87+
{
88+
}
89+
90+
final class com_exception extends Exception
8791
{
8892
}

ext/com_dotnet/com_extension_arginfo.h

Lines changed: 58 additions & 1 deletion
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: 6b162963bcceb90144fdd3165137fb567f916812 */
2+
* Stub hash: ba77cee0a718bcbe7ac280f07a41f9e97a8e2246 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
55
ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
@@ -228,6 +228,63 @@ static const zend_function_entry class_dotnet_methods[] = {
228228
};
229229

230230

231+
static const zend_function_entry class_com_safearray_proxy_methods[] = {
232+
ZEND_FE_END
233+
};
234+
235+
231236
static const zend_function_entry class_com_exception_methods[] = {
232237
ZEND_FE_END
233238
};
239+
240+
static zend_class_entry *register_class_variant(void)
241+
{
242+
zend_class_entry ce, *class_entry;
243+
244+
INIT_CLASS_ENTRY(ce, "variant", class_variant_methods);
245+
class_entry = zend_register_internal_class_ex(&ce, NULL);
246+
247+
return class_entry;
248+
}
249+
250+
static zend_class_entry *register_class_com(zend_class_entry *class_entry_variant)
251+
{
252+
zend_class_entry ce, *class_entry;
253+
254+
INIT_CLASS_ENTRY(ce, "com", class_com_methods);
255+
class_entry = zend_register_internal_class_ex(&ce, class_entry_variant);
256+
257+
return class_entry;
258+
}
259+
260+
static zend_class_entry *register_class_dotnet(zend_class_entry *class_entry_variant)
261+
{
262+
zend_class_entry ce, *class_entry;
263+
264+
INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods);
265+
class_entry = zend_register_internal_class_ex(&ce, class_entry_variant);
266+
267+
return class_entry;
268+
}
269+
270+
static zend_class_entry *register_class_com_safearray_proxy(void)
271+
{
272+
zend_class_entry ce, *class_entry;
273+
274+
INIT_CLASS_ENTRY(ce, "com_safearray_proxy", class_com_safearray_proxy_methods);
275+
class_entry = zend_register_internal_class_ex(&ce, NULL);
276+
class_entry->ce_flags |= ZEND_ACC_FINAL;
277+
278+
return class_entry;
279+
}
280+
281+
static zend_class_entry *register_class_com_exception(zend_class_entry *class_entry_Exception)
282+
{
283+
zend_class_entry ce, *class_entry;
284+
285+
INIT_CLASS_ENTRY(ce, "com_exception", class_com_exception_methods);
286+
class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception);
287+
class_entry->ce_flags |= ZEND_ACC_FINAL;
288+
289+
return class_entry;
290+
}

ext/com_dotnet/com_persist.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,16 +721,12 @@ static zend_object* helper_new(zend_class_entry *ce)
721721

722722
int php_com_persist_minit(INIT_FUNC_ARGS)
723723
{
724-
zend_class_entry ce;
725-
726724
memcpy(&helper_handlers, &std_object_handlers, sizeof(helper_handlers));
727725
helper_handlers.free_obj = helper_free_storage;
728726
helper_handlers.clone_obj = helper_clone;
729727

730-
INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods);
731-
ce.create_object = helper_new;
732-
helper_ce = zend_register_internal_class(&ce);
733-
helper_ce->ce_flags |= ZEND_ACC_FINAL;
728+
helper_ce = register_class_COMPersistHelper();
729+
helper_ce->create_object = helper_new;
734730

735731
le_istream = zend_register_list_destructors_ex(istream_dtor,
736732
NULL, "com_dotnet_istream_wrapper", module_number);

ext/com_dotnet/com_persist.stub.php

Lines changed: 1 addition & 1 deletion
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
final class COMPersistHelper
66
{

ext/com_dotnet/com_persist_arginfo.h

Lines changed: 12 additions & 1 deletion
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: 2c2759e6c1894713439e3ee8da7f56810d00d8cf */
2+
* Stub hash: d14d30fb232f08da37ba0df0b9186eb8bac5e1a4 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_COMPersistHelper___construct, 0, 0, 0)
55
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, variant, variant, 1, "null")
@@ -52,3 +52,14 @@ static const zend_function_entry class_COMPersistHelper_methods[] = {
5252
ZEND_ME(COMPersistHelper, SaveToStream, arginfo_class_COMPersistHelper_SaveToStream, ZEND_ACC_PUBLIC)
5353
ZEND_FE_END
5454
};
55+
56+
static zend_class_entry *register_class_COMPersistHelper(void)
57+
{
58+
zend_class_entry ce, *class_entry;
59+
60+
INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods);
61+
class_entry = zend_register_internal_class_ex(&ce, NULL);
62+
class_entry->ce_flags |= ZEND_ACC_FINAL;
63+
64+
return class_entry;
65+
}

ext/dom/php_dom.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc);
132132
void dom_parent_node_before(dom_object *context, zval *nodes, int nodesc);
133133
void dom_child_node_remove(dom_object *context);
134134

135-
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
136-
INIT_CLASS_ENTRY(ce, name, funcs); \
137-
ce.create_object = dom_objects_new; \
138-
entry = zend_register_internal_class_ex(&ce, parent_ce);
139-
140135
#define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
141136
__intern = Z_DOMOBJ_P(__id); \
142137
if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
@@ -146,7 +141,7 @@ entry = zend_register_internal_class_ex(&ce, parent_ce);
146141
}
147142

148143
#define DOM_NO_ARGS() \
149-
if (zend_parse_parameters_none() == FAILURE) { \
144+
if (zend_parse_parameters_none() == failure) { \
150145
RETURN_THROWS(); \
151146
}
152147

ext/standard/assert.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/* {{{ includes */
1818
#include "php.h"
1919
#include "php_assert.h"
20+
#include "assert_arginfo.h"
2021
#include "php_ini.h"
2122
#include "zend_exceptions.h"
2223
/* }}} */
@@ -89,8 +90,6 @@ static void php_assert_init_globals(zend_assert_globals *assert_globals_p) /* {{
8990

9091
PHP_MINIT_FUNCTION(assert) /* {{{ */
9192
{
92-
zend_class_entry ce;
93-
9493
ZEND_INIT_MODULE_GLOBALS(assert, php_assert_init_globals, NULL);
9594

9695
REGISTER_INI_ENTRIES();
@@ -101,8 +100,7 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
101100
REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
102101
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT);
103102

104-
INIT_CLASS_ENTRY(ce, "AssertionError", NULL);
105-
assertion_error_ce = zend_register_internal_class_ex(&ce, zend_ce_error);
103+
assertion_error_ce = register_class_AssertionError(zend_ce_error);
106104

107105
return SUCCESS;
108106
}

ext/standard/assert.stub.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
/** @generate-class-entries */
4+
5+
class AssertionError extends Error
6+
{
7+
}

ext/standard/assert_arginfo.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: e3b067e1f2a62f92b5d6c4b469dfffd65735095c */
3+
4+
5+
6+
7+
static const zend_function_entry class_AssertionError_methods[] = {
8+
ZEND_FE_END
9+
};
10+
11+
static zend_class_entry *register_class_AssertionError(zend_class_entry *class_entry_Error)
12+
{
13+
zend_class_entry ce, *class_entry;
14+
15+
INIT_CLASS_ENTRY(ce, "AssertionError", class_AssertionError_methods);
16+
class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
17+
18+
return class_entry;
19+
}

ext/standard/basic_functions.stub.php

Lines changed: 1 addition & 1 deletion
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
/* main/main.c */
66

ext/standard/basic_functions_arginfo.h

Lines changed: 1 addition & 1 deletion
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: e9f39cbc595f0f2cdd84e58d4857f9fdb03ff7b7 */
2+
* Stub hash: adbca296811725459f6fbede5a279256675ad19e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)

ext/standard/dir.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,8 @@ PHP_RINIT_FUNCTION(dir)
112112
PHP_MINIT_FUNCTION(dir)
113113
{
114114
static char dirsep_str[2], pathsep_str[2];
115-
zend_class_entry dir_class_entry;
116115

117-
INIT_CLASS_ENTRY(dir_class_entry, "Directory", class_Directory_methods);
118-
dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry);
116+
dir_class_entry_ptr = register_class_Directory();
119117

120118
#ifdef ZTS
121119
ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL);

ext/standard/dir.stub.php

Lines changed: 1 addition & 1 deletion
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 Directory
66
{

ext/standard/dir_arginfo.h

Lines changed: 11 additions & 1 deletion
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: a715bf6a8d5fe69732623cc17f03bd463f369648 */
2+
* Stub hash: 1fd5cc5147c7272006e59d63d68c12caec84589f */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Directory_close, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -20,3 +20,13 @@ static const zend_function_entry class_Directory_methods[] = {
2020
ZEND_ME_MAPPING(read, readdir, arginfo_class_Directory_read, ZEND_ACC_PUBLIC)
2121
ZEND_FE_END
2222
};
23+
24+
static zend_class_entry *register_class_Directory(void)
25+
{
26+
zend_class_entry ce, *class_entry;
27+
28+
INIT_CLASS_ENTRY(ce, "Directory", class_Directory_methods);
29+
class_entry = zend_register_internal_class_ex(&ce, NULL);
30+
31+
return class_entry;
32+
}

0 commit comments

Comments
 (0)