diff --git a/tests/swoole_coroutine/bailout/co_redis_in_shutdown_function.phpt b/tests/swoole_coroutine/bailout/co_redis_in_shutdown_function.phpt index 9c208761163..b0f190a29d4 100644 --- a/tests/swoole_coroutine/bailout/co_redis_in_shutdown_function.phpt +++ b/tests/swoole_coroutine/bailout/co_redis_in_shutdown_function.phpt @@ -8,15 +8,11 @@ require __DIR__ . '/../../include/bootstrap.php'; use Swoole\Event; -Co\run(function (){ - $redis = new \redis(); - $redis->connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT); +Co\run(function () { + $redis = new \redis(); + $redis->connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT); register_shutdown_function(function () use ($redis) { - try { - $redis->get('key'); - }catch (Exception $e) { - var_dump($e); - } + $redis->get('key'); }); usleep(10000); }); @@ -24,3 +20,9 @@ Co\run(function (){ Event::wait(); ?> --EXPECTF-- +Fatal error: Uncaught Swoole\Error: API must be called in the coroutine in %s:%d +Stack trace: +#0 %s(%d): Redis->get('key') +#1 [internal function]: {closure}() +#2 {main} + thrown in %s on line %d