File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -864,6 +864,11 @@ void PHPCoroutine::fiber_context_try_destroy(PHPContext *ctx) {
864864}
865865
866866zend_fiber_status PHPCoroutine::get_fiber_status (PHPContext *ctx) {
867+ // main_context
868+ if (ctx->fiber_context == EG (main_fiber_context)) {
869+ return ZEND_FIBER_STATUS_RUNNING;
870+ }
871+
867872 switch (ctx->co ->get_state ()) {
868873 case Coroutine::STATE_INIT:
869874 return ZEND_FIBER_STATUS_INIT;
Original file line number Diff line number Diff line change 1+ --TEST--
2+ swoole_coroutine: Github bug #5699
3+ --SKIPIF--
4+ <?php require __DIR__ . '/../include/skipif.inc ' ; ?>
5+ --FILE--
6+ <?php
7+ require __DIR__ . '/../include/bootstrap.php ' ;
8+ ini_set ('swoole.enable_fiber_mock ' , 'On ' );
9+ use function Swoole \Coroutine \run ;
10+
11+ run (function () {
12+ sleep (1 );
13+ });
14+ ?>
15+ --EXPECT--
You can’t perform that action at this time.
0 commit comments