Skip to content

Commit 6e05346

Browse files
committed
Fix fiber garbage collection logic and update test expectations
1 parent 0c41d8b commit 6e05346

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Zend/zend_fibers.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ static void zend_fiber_object_destroy(zend_object *object)
12821282
fiber->coroutine = NULL;
12831283
coroutine->extended_data = NULL;
12841284

1285-
if (ZEND_COROUTINE_IS_FINISHED(coroutine)) {
1285+
if (ZEND_COROUTINE_IS_FINISHED(coroutine) || false == ZEND_COROUTINE_IS_STARTED(coroutine)) {
12861286
/*
12871287
* If fcall is not NULL, ownership was NOT taken by
12881288
* coroutine_entry_point (coroutine did not start execution).
@@ -1317,7 +1317,10 @@ static void zend_fiber_object_destroy(zend_object *object)
13171317
);
13181318

13191319
ZEND_ASYNC_CANCEL(coroutine, exception, true);
1320-
ZEND_ASYNC_EVENT_RELEASE(&coroutine->event);
1320+
1321+
if (ZEND_COROUTINE_IS_STARTED(coroutine)) {
1322+
ZEND_ASYNC_EVENT_RELEASE(&coroutine->event);
1323+
}
13211324

13221325
return;
13231326
}

0 commit comments

Comments
 (0)