Skip to content

Commit 7c2956d

Browse files
committed
Merge branch 'PHP-5.6'
* PHP-5.6: Prevent GC from changing zval or object 'color' before they are actually inserted into possible roots buffer. Conflicts: NEWS Zend/zend_gc.c
2 parents 0d240c3 + baf5fdf commit 7c2956d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Zend/zend_gc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
147147
GC_BENCH_INC(zval_possible_root);
148148

149149
if (EXPECTED(GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK)) {
150-
GC_SET_PURPLE(GC_INFO(ref));
151-
152150
if (!GC_ADDRESS(GC_INFO(ref))) {
153151
gc_root_buffer *newRoot = GC_G(unused);
154152

@@ -159,7 +157,6 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
159157
GC_G(first_unused)++;
160158
} else {
161159
if (!GC_G(gc_enabled)) {
162-
GC_SET_BLACK(GC_INFO(ref));
163160
return;
164161
}
165162
GC_REFCOUNT(ref)++;
@@ -169,10 +166,10 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
169166
if (!newRoot) {
170167
return;
171168
}
172-
GC_SET_PURPLE(GC_INFO(ref));
173169
GC_G(unused) = newRoot->prev;
174170
}
175171

172+
GC_SET_PURPLE(GC_INFO(ref));
176173
newRoot->next = GC_G(roots).next;
177174
newRoot->prev = &GC_G(roots);
178175
GC_G(roots).next->prev = newRoot;

0 commit comments

Comments
 (0)