]> granicus.if.org Git - php/commitdiff
Don't set GC_HAS_DESTRUCTORS flag if destructors were already called
authorDmitry Stogov <dmitry@zend.com>
Tue, 6 Aug 2019 08:35:53 +0000 (11:35 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 6 Aug 2019 08:35:53 +0000 (11:35 +0300)
Zend/zend_gc.c

index 5b5784fc42891ff3653b9f8f29927ef3bbe4cace..be00bc73a6dd4225ceb25d2f498b7dafafec03e3 100644 (file)
@@ -1158,8 +1158,9 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
                                if (!GC_INFO(ref)) {
                                        gc_add_garbage(ref);
                                }
-                               if (obj->handlers->dtor_obj != zend_objects_destroy_object ||
-                                               obj->ce->destructor != NULL) {
+                               if (!(OBJ_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)
+                                && (obj->handlers->dtor_obj != zend_objects_destroy_object
+                                 || obj->ce->destructor != NULL)) {
                                        *flags |= GC_HAS_DESTRUCTORS;
                                }
                                ZVAL_OBJ(&tmp, obj);