Skip to content

Commit 9899fdc

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Handle reallocated root buffer during GC destroy phase Zend Engine version is no longer in -dev
2 parents a758089 + 3f4a151 commit 9899fdc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Zend/zend_gc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,11 +1537,11 @@ ZEND_API int zend_gc_collect_cycles(void)
15371537
}
15381538
}
15391539

1540-
/* Destroy zvals */
1540+
/* Destroy zvals. The root buffer may be reallocated. */
15411541
GC_TRACE("Destroying zvals");
1542-
current = GC_IDX2PTR(GC_FIRST_ROOT);
1543-
last = GC_IDX2PTR(GC_G(first_unused));
1544-
while (current != last) {
1542+
idx = GC_FIRST_ROOT;
1543+
while (idx != end) {
1544+
current = GC_IDX2PTR(idx);
15451545
if (GC_IS_GARBAGE(current->ref)) {
15461546
p = GC_GET_PTR(current->ref);
15471547
GC_TRACE_REF(p, "destroying");
@@ -1572,11 +1572,12 @@ ZEND_API int zend_gc_collect_cycles(void)
15721572
zend_hash_destroy(arr);
15731573
}
15741574
}
1575-
current++;
1575+
idx++;
15761576
}
15771577

15781578
/* Free objects */
15791579
current = GC_IDX2PTR(GC_FIRST_ROOT);
1580+
last = GC_IDX2PTR(end);
15801581
while (current != last) {
15811582
if (GC_IS_GARBAGE(current->ref)) {
15821583
p = GC_GET_PTR(current->ref);

0 commit comments

Comments
 (0)