Skip to content

Commit 94ee4f9

Browse files
committed
Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
1 parent 800c667 commit 94ee4f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+108
-115
lines changed

Zend/zend_inheritance.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
14721472
zend_string_release_ex(ce->parent_name, 0);
14731473
}
14741474
ce->parent = parent_ce;
1475+
ce->default_object_handlers = parent_ce->default_object_handlers;
14751476
ce->ce_flags |= ZEND_ACC_RESOLVED_PARENT;
14761477

14771478
/* Inherit properties */

Zend/zend_iterators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static const zend_object_handlers iterator_object_handlers = {
5757
ZEND_API void zend_register_iterator_wrapper(void)
5858
{
5959
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
60+
zend_iterator_class_entry.default_object_handlers = &iterator_object_handlers;
6061
}
6162

6263
static void iter_wrapper_free(zend_object *object)
@@ -83,7 +84,6 @@ static HashTable *iter_wrapper_get_gc(zend_object *object, zval **table, int *n)
8384
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
8485
{
8586
zend_object_std_init(&iter->std, &zend_iterator_class_entry);
86-
iter->std.handlers = &iterator_object_handlers;
8787
}
8888

8989
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter)

ext/com_dotnet/com_extension.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,22 @@ PHP_MINIT_FUNCTION(com_dotnet)
184184

185185
php_com_saproxy_class_entry = register_class_com_safearray_proxy();
186186
/* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
187+
php_com_saproxy_class_entry->default_object_handlers = &php_com_saproxy_handlers;
187188
php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
188189

189190
php_com_variant_class_entry = register_class_variant();
191+
php_com_variant_class_entry->default_object_handlers = &php_com_object_handlers;
190192
php_com_variant_class_entry->create_object = php_com_object_new;
191193
php_com_variant_class_entry->get_iterator = php_com_iter_get;
192194

193195
tmp = register_class_com(php_com_variant_class_entry);
196+
tmp->default_object_handlers = &php_com_object_handlers;
194197
tmp->create_object = php_com_object_new;
195198
tmp->get_iterator = php_com_iter_get;
196199

197200
#if HAVE_MSCOREE_H
198201
tmp = register_class_dotnet(php_com_variant_class_entry);
202+
tmp->default_object_handlers = &php_com_object_handlers;
199203
tmp->create_object = php_com_object_new;
200204
tmp->get_iterator = php_com_iter_get;
201205
#endif

ext/com_dotnet/com_handlers.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ zend_object* php_com_object_new(zend_class_entry *ce)
627627
obj->ce = ce;
628628

629629
zend_object_std_init(&obj->zo, ce);
630-
obj->zo.handlers = &php_com_object_handlers;
631630

632631
obj->typeinfo = NULL;
633632

ext/com_dotnet/com_misc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
6161
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo);
6262

6363
zend_object_std_init(&obj->zo, php_com_variant_class_entry);
64-
obj->zo.handlers = &php_com_object_handlers;
6564
ZVAL_OBJ(z, &obj->zo);
6665
}
6766

@@ -85,7 +84,6 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
8584
}
8685

8786
zend_object_std_init(&obj->zo, php_com_variant_class_entry);
88-
obj->zo.handlers = &php_com_object_handlers;
8987
ZVAL_OBJ(z, &obj->zo);
9088
}
9189

ext/com_dotnet/com_persist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ static zend_object* helper_new(zend_class_entry *ce)
709709
memset(helper, 0, sizeof(*helper));
710710

711711
zend_object_std_init(&helper->std, helper_ce);
712-
helper->std.handlers = &helper_handlers;
713712

714713
return &helper->std;
715714
}
@@ -722,6 +721,7 @@ void php_com_persist_minit(INIT_FUNC_ARGS)
722721

723722
helper_ce = register_class_COMPersistHelper();
724723
helper_ce->create_object = helper_new;
724+
helper_ce->default_object_handlers = &helper_handlers;
725725

726726
le_istream = zend_register_list_destructors_ex(istream_dtor,
727727
NULL, "com_dotnet_istream_wrapper", module_number);

ext/com_dotnet/com_saproxy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ void php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *inde
440440
ZVAL_DUP(&proxy->indices[proxy->dimensions-1], index);
441441

442442
zend_object_std_init(&proxy->std, php_com_saproxy_class_entry);
443-
proxy->std.handlers = &php_com_saproxy_handlers;
444443
ZVAL_OBJ(proxy_out, &proxy->std);
445444
}
446445

ext/com_dotnet/php_com_dotnet_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void php_com_object_enable_event_sink(php_com_dotnet_object *obj, bool enable);
7878
/* com_saproxy.c */
7979
zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref);
8080
void php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index);
81+
extern zend_object_handlers php_com_saproxy_handlers;
8182

8283
/* com_olechar.c */
8384
PHP_COM_DOTNET_API zend_string *php_com_olestring_to_string(OLECHAR *olestring, int codepage);

ext/curl/interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ PHP_MINIT_FUNCTION(curl)
398398

399399
curl_ce = register_class_CurlHandle();
400400
curl_ce->create_object = curl_create_object;
401+
curl_ce->default_object_handlers = &curl_object_handlers;
401402

402403
memcpy(&curl_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
403404
curl_object_handlers.offset = XtOffsetOf(php_curl, std);
@@ -426,7 +427,6 @@ static zend_object *curl_create_object(zend_class_entry *class_type) {
426427

427428
zend_object_std_init(&intern->std, class_type);
428429
object_properties_init(&intern->std, class_type);
429-
intern->std.handlers = &curl_object_handlers;
430430

431431
return &intern->std;
432432
}

ext/curl/multi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,11 @@ PHP_FUNCTION(curl_multi_setopt)
512512

513513
/* CurlMultiHandle class */
514514

515-
static zend_object_handlers curl_multi_handlers;
516-
517515
static zend_object *curl_multi_create_object(zend_class_entry *class_type) {
518516
php_curlm *intern = zend_object_alloc(sizeof(php_curlm), class_type);
519517

520518
zend_object_std_init(&intern->std, class_type);
521519
object_properties_init(&intern->std, class_type);
522-
intern->std.handlers = &curl_multi_handlers;
523520

524521
return &intern->std;
525522
}
@@ -582,8 +579,11 @@ static HashTable *curl_multi_get_gc(zend_object *object, zval **table, int *n)
582579
return zend_std_get_properties(object);
583580
}
584581

582+
static zend_object_handlers curl_multi_handlers;
583+
585584
void curl_multi_register_handlers(void) {
586585
curl_multi_ce->create_object = curl_multi_create_object;
586+
curl_multi_ce->default_object_handlers = &curl_multi_handlers;
587587

588588
memcpy(&curl_multi_handlers, &std_object_handlers, sizeof(zend_object_handlers));
589589
curl_multi_handlers.offset = XtOffsetOf(php_curlm, std);

0 commit comments

Comments
 (0)