From d77eb74a5fcf44219dfeba0eeb2d3a0baaa39b19 Mon Sep 17 00:00:00 2001 From: matyhtf Date: Thu, 17 Oct 2024 14:27:17 +0800 Subject: [PATCH] Fix thread tests, optimize swoole_implicit_fn --filter=[thread][compile] --- ext-src/php_swoole.cc | 2 ++ tests/swoole_thread/server/exit.phpt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ext-src/php_swoole.cc b/ext-src/php_swoole.cc index c9329bc3ca..00cf34f6a7 100644 --- a/ext-src/php_swoole.cc +++ b/ext-src/php_swoole.cc @@ -1525,5 +1525,7 @@ static PHP_FUNCTION(swoole_implicit_fn) { #endif } else if (SW_STRCASEEQ(fn, l_fn, "abort")) { abort(); + } else { + zend_throw_exception_ex(swoole_exception_ce, SW_ERROR_INVALID_PARAMS, "unknown fn '%s'", fn); } } diff --git a/tests/swoole_thread/server/exit.phpt b/tests/swoole_thread/server/exit.phpt index 4187c037d9..db62bd78b9 100644 --- a/tests/swoole_thread/server/exit.phpt +++ b/tests/swoole_thread/server/exit.phpt @@ -46,7 +46,7 @@ $serv->on('WorkerStop', function (Server $serv, $workerId) { }); $serv->on('Request', function ($req, $resp) use ($serv) { if ($req->server['request_uri'] == '/exit') { - swoole_implicit_fn('exit', CODE); + swoole_implicit_fn('bailout', CODE); } }); $serv->on('shutdown', function () {