Skip to content

Commit 6627802

Browse files
committed
wip
1 parent 6173a48 commit 6627802

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ext/intl/common/common_enum.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,22 @@ static void zoi_with_current_destroy_self(zend_object_iterator *iter, zoi_with_c
4747
void zoi_with_current_dtor(zend_object_iterator *iter)
4848
{
4949
zoi_with_current *zoiwc = (zoi_with_current*)iter;
50-
50+
printf("zoiwc=%p\n", zoiwc);
5151
if (!Z_ISUNDEF(zoiwc->wrapping_obj)) {
52+
printf("not undef wrapper\n");
5253
/* we have to copy the pointer because zoiwc->wrapping_obj may be
5354
* changed midway the execution of zval_ptr_dtor() */
5455
zval *zwo = &zoiwc->wrapping_obj;
5556

5657
/* object is still here, we can rely on it to call this again and
5758
* destroy this object */
59+
printf("refcount %d\n", Z_REFCOUNT_P(zwo));
5860
zval_ptr_dtor(zwo);
5961

6062
/* We may only invalidate and destroy if this was actually the last instance.
6163
* If it was, then IntlIterator_objects_free() will have set zwo to UNDEF. */
6264
if (Z_ISUNDEF_P(zwo)) {
65+
printf("NOW undef wrapper\n");
6366
zoi_with_current_destroy_self(iter, zoiwc);
6467
}
6568
} else {
@@ -178,8 +181,11 @@ static void IntlIterator_objects_free(zend_object *object)
178181
{
179182
IntlIterator_object *ii = php_intl_iterator_fetch_object(object);
180183

184+
printf("free parent\n");
185+
181186
if (ii->iterator) {
182187
zval *wrapping_objp = &((zoi_with_current*)ii->iterator)->wrapping_obj;
188+
// zval_ptr_dtor(wrapping_objp);
183189
/* Signal that it was the last reference that got destroyed */
184190
ZVAL_UNDEF(wrapping_objp);
185191
zend_iterator_dtor(ii->iterator);
@@ -198,12 +204,14 @@ static HashTable *IntlIterator_get_gc(zend_object *object, zval **table, int *n)
198204
zend_get_gc_buffer_add_obj(gc, &ii->iterator->std);
199205
/* current can't participate in a cycle */
200206
zend_get_gc_buffer_use(gc, table, n);
207+
208+
// TODO: can be optimized
209+
return zend_std_get_properties(object);
201210
} else {
202211
*table = NULL;
203212
*n = 0;
213+
return zend_std_get_gc(object, table, n);
204214
}
205-
206-
return zend_std_get_properties(object);
207215
}
208216

209217
static zend_object_iterator *IntlIterator_get_iterator(

0 commit comments

Comments
 (0)