]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1'
authorXinchen Hui <laruence@gmail.com>
Mon, 13 Feb 2017 11:24:00 +0000 (19:24 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 13 Feb 2017 11:24:00 +0000 (19:24 +0800)
* PHP-7.1:
  Update NEWS
  Fixed bug  #73989 (PHP 7.1 Segfaults within Symfony test suite)

Conflicts:
Zend/zend_gc.c

1  2 
Zend/zend_gc.c
Zend/zend_gc.h

diff --cc Zend/zend_gc.c
index 9d1a9e4c39151e31f9b55324b3786c6ef4af829e,087f04bc3ff78121c3daa27db5e4bc04a53a853b..5aaef4ff8fefcca9b4a446cc7af5a40ff57f5f1b
@@@ -1084,44 -1108,45 +1103,44 @@@ ZEND_API int zend_gc_collect_cycles(voi
  
                if (gc_flags & GC_HAS_DESTRUCTORS) {
                        GC_TRACE("Calling destructors");
 -                      if (EG(objects_store).object_buckets) {
 -                              /* Remember reference counters before calling destructors */
 -                              current = to_free.next;
 -                              while (current != &to_free) {
 -                                      current->refcount = GC_REFCOUNT(current->ref);
 -                                      current = current->next;
 -                              }
  
 -                              /* Call destructors */
 -                              current = to_free.next;
 -                              while (current != &to_free) {
 -                                      p = current->ref;
 -                                      GC_G(next_to_free) = current->next;
 -                                      if (GC_TYPE(p) == IS_OBJECT) {
 -                                              zend_object *obj = (zend_object*)p;
 -
 -                                              if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
 -                                                      !(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
 -                                                      GC_TRACE_REF(obj, "calling destructor");
 -                                                      GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
 -                                                      if (obj->handlers->dtor_obj) {
 -                                                              GC_REFCOUNT(obj)++;
 -                                                              obj->handlers->dtor_obj(obj);
 -                                                              GC_REFCOUNT(obj)--;
 -                                                      }
 +                      /* Remember reference counters before calling destructors */
 +                      current = to_free.next;
 +                      while (current != &to_free) {
 +                              current->refcount = GC_REFCOUNT(current->ref);
 +                              current = current->next;
 +                      }
 +
 +                      /* Call destructors */
 +                      current = to_free.next;
 +                      while (current != &to_free) {
 +                              p = current->ref;
 +                              GC_G(next_to_free) = current->next;
-                               if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
++                              if (GC_TYPE(p) == IS_OBJECT) {
 +                                      zend_object *obj = (zend_object*)p;
 +
 +                                      if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
 +                                              !(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
 +                                              GC_TRACE_REF(obj, "calling destructor");
 +                                              GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
 +                                              if (obj->handlers->dtor_obj) {
 +                                                      GC_REFCOUNT(obj)++;
 +                                                      obj->handlers->dtor_obj(obj);
 +                                                      GC_REFCOUNT(obj)--;
                                                }
                                        }
 -                                      current = GC_G(next_to_free);
                                }
 +                              current = GC_G(next_to_free);
 +                      }
  
 -                              /* Remove values captured in destructors */
 -                              current = to_free.next;
 -                              while (current != &to_free) {
 -                                      GC_G(next_to_free) = current->next;
 -                                      if (GC_REFCOUNT(current->ref) > current->refcount) {
 -                                              gc_remove_nested_data_from_buffer(current->ref, current);
 -                                      }
 -                                      current = GC_G(next_to_free);
 +                      /* Remove values captured in destructors */
 +                      current = to_free.next;
 +                      while (current != &to_free) {
 +                              GC_G(next_to_free) = current->next;
 +                              if (GC_REFCOUNT(current->ref) > current->refcount) {
 +                                      gc_remove_nested_data_from_buffer(current->ref, current);
                                }
 +                              current = GC_G(next_to_free);
                        }
                }
  
                        p = current->ref;
                        GC_G(next_to_free) = current->next;
                        GC_TRACE_REF(p, "destroying");
-                       if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
+                       if (GC_TYPE(p) == IS_OBJECT) {
                                zend_object *obj = (zend_object*)p;
  
 -                              if (EG(objects_store).object_buckets &&
 -                                  IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle])) {
 +                              if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle])) {
                                        EG(objects_store).object_buckets[obj->handle] = SET_OBJ_INVALID(obj);
                                        GC_TYPE(obj) = IS_NULL;
                                        if (!(GC_FLAGS(obj) & IS_OBJ_FREE_CALLED)) {
diff --cc Zend/zend_gc.h
Simple merge