@@ -379,9 +379,7 @@ static void gc_scan_black(zend_refcounted *ref)
379
379
zend_object_get_gc_t get_gc ;
380
380
zend_object * obj = (zend_object * )ref ;
381
381
382
- ZEND_ASSERT (EG (objects_store ).object_buckets != NULL );
383
382
if (EXPECTED (!(GC_FLAGS (ref ) & IS_OBJ_FREE_CALLED ) &&
384
- IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
385
383
(get_gc = obj -> handlers -> get_gc ) != NULL )) {
386
384
int n ;
387
385
zval * zv , * end ;
@@ -491,9 +489,7 @@ static void gc_mark_grey(zend_refcounted *ref)
491
489
zend_object_get_gc_t get_gc ;
492
490
zend_object * obj = (zend_object * )ref ;
493
491
494
- ZEND_ASSERT (EG (objects_store ).object_buckets != NULL );
495
492
if (EXPECTED (!(GC_FLAGS (ref ) & IS_OBJ_FREE_CALLED ) &&
496
- IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
497
493
(get_gc = obj -> handlers -> get_gc ) != NULL )) {
498
494
int n ;
499
495
zval * zv , * end ;
@@ -606,9 +602,7 @@ static void gc_scan(zend_refcounted *ref)
606
602
zend_object_get_gc_t get_gc ;
607
603
zend_object * obj = (zend_object * )ref ;
608
604
609
- ZEND_ASSERT (EG (objects_store ).object_buckets != NULL );
610
605
if (EXPECTED (!(GC_FLAGS (ref ) & IS_OBJ_FREE_CALLED ) &&
611
- IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
612
606
(get_gc = obj -> handlers -> get_gc ) != NULL )) {
613
607
int n ;
614
608
zval * zv , * end ;
@@ -770,9 +764,7 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags)
770
764
zend_object_get_gc_t get_gc ;
771
765
zend_object * obj = (zend_object * )ref ;
772
766
773
- ZEND_ASSERT (EG (objects_store ).object_buckets != NULL );
774
767
if (EXPECTED (!(GC_FLAGS (ref ) & IS_OBJ_FREE_CALLED ) &&
775
- IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
776
768
(get_gc = obj -> handlers -> get_gc ) != NULL )) {
777
769
int n ;
778
770
zval * zv , * end ;
@@ -964,9 +956,7 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
964
956
zend_object_get_gc_t get_gc ;
965
957
zend_object * obj = (zend_object * )ref ;
966
958
967
- ZEND_ASSERT (EG (objects_store ).object_buckets != NULL );
968
959
if (EXPECTED (!(GC_FLAGS (ref ) & IS_OBJ_FREE_CALLED ) &&
969
- IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
970
960
(get_gc = obj -> handlers -> get_gc ) != NULL )) {
971
961
int n ;
972
962
zval * zv , * end ;
@@ -1122,11 +1112,12 @@ ZEND_API int zend_gc_collect_cycles(void)
1122
1112
if (GC_TYPE (p ) == IS_OBJECT ) {
1123
1113
zend_object * obj = (zend_object * )p ;
1124
1114
1125
- if (IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ]) &&
1126
- !(GC_FLAGS (obj ) & IS_OBJ_DESTRUCTOR_CALLED )) {
1115
+ if (!(GC_FLAGS (obj ) & IS_OBJ_DESTRUCTOR_CALLED )) {
1127
1116
GC_TRACE_REF (obj , "calling destructor" );
1128
1117
GC_FLAGS (obj ) |= IS_OBJ_DESTRUCTOR_CALLED ;
1129
- if (obj -> handlers -> dtor_obj ) {
1118
+ if (obj -> handlers -> dtor_obj
1119
+ && (obj -> handlers -> dtor_obj != zend_objects_destroy_object
1120
+ || obj -> ce -> destructor )) {
1130
1121
GC_REFCOUNT (obj )++ ;
1131
1122
obj -> handlers -> dtor_obj (obj );
1132
1123
GC_REFCOUNT (obj )-- ;
@@ -1158,21 +1149,19 @@ ZEND_API int zend_gc_collect_cycles(void)
1158
1149
if (GC_TYPE (p ) == IS_OBJECT ) {
1159
1150
zend_object * obj = (zend_object * )p ;
1160
1151
1161
- if (IS_OBJ_VALID (EG (objects_store ).object_buckets [obj -> handle ])) {
1162
- EG (objects_store ).object_buckets [obj -> handle ] = SET_OBJ_INVALID (obj );
1163
- GC_TYPE (obj ) = IS_NULL ;
1164
- if (!(GC_FLAGS (obj ) & IS_OBJ_FREE_CALLED )) {
1165
- GC_FLAGS (obj ) |= IS_OBJ_FREE_CALLED ;
1166
- if (obj -> handlers -> free_obj ) {
1167
- GC_REFCOUNT (obj )++ ;
1168
- obj -> handlers -> free_obj (obj );
1169
- GC_REFCOUNT (obj )-- ;
1170
- }
1152
+ EG (objects_store ).object_buckets [obj -> handle ] = SET_OBJ_INVALID (obj );
1153
+ GC_TYPE (obj ) = IS_NULL ;
1154
+ if (!(GC_FLAGS (obj ) & IS_OBJ_FREE_CALLED )) {
1155
+ GC_FLAGS (obj ) |= IS_OBJ_FREE_CALLED ;
1156
+ if (obj -> handlers -> free_obj ) {
1157
+ GC_REFCOUNT (obj )++ ;
1158
+ obj -> handlers -> free_obj (obj );
1159
+ GC_REFCOUNT (obj )-- ;
1171
1160
}
1172
- SET_OBJ_BUCKET_NUMBER (EG (objects_store ).object_buckets [obj -> handle ], EG (objects_store ).free_list_head );
1173
- EG (objects_store ).free_list_head = obj -> handle ;
1174
- p = current -> ref = (zend_refcounted * )(((char * )obj ) - obj -> handlers -> offset );
1175
1161
}
1162
+ SET_OBJ_BUCKET_NUMBER (EG (objects_store ).object_buckets [obj -> handle ], EG (objects_store ).free_list_head );
1163
+ EG (objects_store ).free_list_head = obj -> handle ;
1164
+ p = current -> ref = (zend_refcounted * )(((char * )obj ) - obj -> handlers -> offset );
1176
1165
} else if (GC_TYPE (p ) == IS_ARRAY ) {
1177
1166
zend_array * arr = (zend_array * )p ;
1178
1167
0 commit comments