Skip to content

Commit f0f3fe0

Browse files
committed
Don't include non-refcounted structures in GC count
1 parent 7bd2b9d commit f0f3fe0

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

Zend/tests/gc_017.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ $a->insert($c);
3131
unset($a);
3232
unset($b);
3333
unset($c);
34-
var_dump(gc_collect_cycles() >= 7);
34+
var_dump(gc_collect_cycles());
3535
echo "ok\n"
3636
?>
3737
--EXPECTF--
3838
string(1) "%s"
3939
string(1) "%s"
4040
string(1) "%s"
41-
bool(true)
41+
int(4)
4242
ok

Zend/tests/gc_033.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ for ($i=0; $i<9999; $i++) {
2727
var_dump(gc_collect_cycles());
2828
?>
2929
--EXPECT--
30-
int(20001)
30+
int(10002)

Zend/zend_gc.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,10 +1183,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
11831183
ht = NULL;
11841184
if (!n) goto next;
11851185
while (!Z_REFCOUNTED_P(--end)) {
1186-
/* count non-refcounted for compatibility ??? */
1187-
if (Z_TYPE_P(zv) != IS_UNDEF) {
1188-
count++;
1189-
}
11901186
if (zv == end) goto next;
11911187
}
11921188
} else {
@@ -1200,9 +1196,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
12001196
GC_REF_SET_BLACK(ref);
12011197
GC_STACK_PUSH(ref);
12021198
}
1203-
/* count non-refcounted for compatibility ??? */
1204-
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
1205-
count++;
12061199
}
12071200
zv++;
12081201
}
@@ -1250,10 +1243,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
12501243
if (Z_REFCOUNTED_P(zv)) {
12511244
break;
12521245
}
1253-
/* count non-refcounted for compatibility ??? */
1254-
if (Z_TYPE_P(zv) != IS_UNDEF) {
1255-
count++;
1256-
}
12571246
if (p == end) goto next;
12581247
}
12591248
while (p != end) {
@@ -1268,9 +1257,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
12681257
GC_REF_SET_BLACK(ref);
12691258
GC_STACK_PUSH(ref);
12701259
}
1271-
/* count non-refcounted for compatibility ??? */
1272-
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
1273-
count++;
12741260
}
12751261
p++;
12761262
}

0 commit comments

Comments
 (0)