@@ -47,19 +47,22 @@ static void zoi_with_current_destroy_self(zend_object_iterator *iter, zoi_with_c
47
47
void zoi_with_current_dtor (zend_object_iterator *iter)
48
48
{
49
49
zoi_with_current *zoiwc = (zoi_with_current*)iter;
50
-
50
+ printf ( " zoiwc=%p \n " , zoiwc);
51
51
if (!Z_ISUNDEF (zoiwc->wrapping_obj )) {
52
+ printf (" not undef wrapper\n " );
52
53
/* we have to copy the pointer because zoiwc->wrapping_obj may be
53
54
* changed midway the execution of zval_ptr_dtor() */
54
55
zval *zwo = &zoiwc->wrapping_obj ;
55
56
56
57
/* object is still here, we can rely on it to call this again and
57
58
* destroy this object */
59
+ printf (" refcount %d\n " , Z_REFCOUNT_P (zwo));
58
60
zval_ptr_dtor (zwo);
59
61
60
62
/* We may only invalidate and destroy if this was actually the last instance.
61
63
* If it was, then IntlIterator_objects_free() will have set zwo to UNDEF. */
62
64
if (Z_ISUNDEF_P (zwo)) {
65
+ printf (" NOW undef wrapper\n " );
63
66
zoi_with_current_destroy_self (iter, zoiwc);
64
67
}
65
68
} else {
@@ -178,8 +181,11 @@ static void IntlIterator_objects_free(zend_object *object)
178
181
{
179
182
IntlIterator_object *ii = php_intl_iterator_fetch_object (object);
180
183
184
+ printf (" free parent\n " );
185
+
181
186
if (ii->iterator ) {
182
187
zval *wrapping_objp = &((zoi_with_current*)ii->iterator )->wrapping_obj ;
188
+ // zval_ptr_dtor(wrapping_objp);
183
189
/* Signal that it was the last reference that got destroyed */
184
190
ZVAL_UNDEF (wrapping_objp);
185
191
zend_iterator_dtor (ii->iterator );
@@ -198,12 +204,14 @@ static HashTable *IntlIterator_get_gc(zend_object *object, zval **table, int *n)
198
204
zend_get_gc_buffer_add_obj (gc, &ii->iterator ->std );
199
205
/* current can't participate in a cycle */
200
206
zend_get_gc_buffer_use (gc, table, n);
207
+
208
+ // TODO: can be optimized
209
+ return zend_std_get_properties (object);
201
210
} else {
202
211
*table = NULL ;
203
212
*n = 0 ;
213
+ return zend_std_get_gc (object, table, n);
204
214
}
205
-
206
- return zend_std_get_properties (object);
207
215
}
208
216
209
217
static zend_object_iterator *IntlIterator_get_iterator (
0 commit comments