diff --git a/config.m4 b/config.m4 index 23a7d3067c1..06cafaec272 100644 --- a/config.m4 +++ b/config.m4 @@ -1085,6 +1085,10 @@ EOF swoole_source_file="$swoole_source_file \ ${PHP_THIRDPARTY_DIR}/pdo_pgsql/pgsql_driver.c \ ${PHP_THIRDPARTY_DIR}/pdo_pgsql/pgsql_statement.c" + if test "$PHP_VERSION_ID" -ge "84"; then + swoole_source_file="$swoole_source_file \ + ${PHP_THIRDPARTY_DIR}/pdo_pgsql/pgsql_sql_parser.c" + fi fi if test "$PHP_SWOOLE_ORACLE" != "no"; then @@ -1103,6 +1107,10 @@ EOF swoole_source_file="$swoole_source_file \ ${PHP_THIRDPARTY_DIR}/pdo_sqlite/sqlite_driver.c \ ${PHP_THIRDPARTY_DIR}/pdo_sqlite/sqlite_statement.c" + if test "$PHP_VERSION_ID" -ge "84"; then + swoole_source_file="$swoole_source_file \ + ${PHP_THIRDPARTY_DIR}/pdo_sqlite/sqlite_sql_parser.c" + fi fi SW_ASM_DIR="thirdparty/boost/asm/" diff --git a/ext-src/swoole_coroutine.cc b/ext-src/swoole_coroutine.cc index eb7c13abb4e..fc3f456a176 100644 --- a/ext-src/swoole_coroutine.cc +++ b/ext-src/swoole_coroutine.cc @@ -225,7 +225,7 @@ static int coro_exit_handler(zend_execute_data *execute_data) { } #else SW_EXTERN_C_BEGIN -extern ZEND_FUNCTION(exit); +bool swoole_call_original_handler(const char *name, INTERNAL_FUNCTION_PARAMETERS); PHP_FUNCTION(swoole_exit) { zend_long flags = 0; if (Coroutine::get_current()) { @@ -251,7 +251,7 @@ PHP_FUNCTION(swoole_exit) { zend_update_property_long(swoole_exit_exception_ce, SW_Z8_OBJ_P(&ex), ZEND_STRL("flags"), flags); zend_update_property_long(swoole_exit_exception_ce, SW_Z8_OBJ_P(&ex), ZEND_STRL("status"), status); } else { - ZEND_FN(exit)(INTERNAL_FUNCTION_PARAM_PASSTHRU); + swoole_call_original_handler("exit", INTERNAL_FUNCTION_PARAM_PASSTHRU); } } SW_EXTERN_C_END diff --git a/ext-src/swoole_runtime.cc b/ext-src/swoole_runtime.cc index 13827f9788e..6fbfafdc31f 100644 --- a/ext-src/swoole_runtime.cc +++ b/ext-src/swoole_runtime.cc @@ -1170,6 +1170,18 @@ static bool enable_func(const char *name, size_t l_name) { return true; } +SW_EXTERN_C_BEGIN +bool swoole_call_original_handler(const char *name, INTERNAL_FUNCTION_PARAMETERS) { + real_func *rf = (real_func *) zend_hash_str_find_ptr(tmp_function_table, name, strlen(name)); + if (!rf) { + return false; + } + rf->ori_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + return true; +} +SW_EXTERN_C_END + void PHPCoroutine::disable_unsafe_function() { for (auto &f : unsafe_functions) { disable_func(f.c_str(), f.length()); diff --git a/tests/include/functions.php b/tests/include/functions.php index 048aedbe0a3..c2a76fbbaf5 100644 --- a/tests/include/functions.php +++ b/tests/include/functions.php @@ -385,7 +385,7 @@ function get_big_random(int $length = 1024 * 1024) return str_repeat(get_safe_random(1024), $length / 1024); } -function makeCoTcpClient($host, $port, callable $onConnect = null, callable $onReceive = null) +function makeCoTcpClient($host, $port, ?callable $onConnect = null, ?callable $onReceive = null) { go(function () use ($host, $port, $onConnect, $onReceive) { $cli = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP); @@ -462,7 +462,7 @@ function killself_in_syncmode($lifetime = 1000, $sig = SIGKILL) * @param callable $cb * @return mixed */ -function suicide($lifetime, $sig = SIGKILL, callable $cb = null) +function suicide($lifetime, $sig = SIGKILL, ?callable $cb = null) { return Swoole\Timer::after($lifetime, function () use ($lifetime, $sig, $cb) { if ($cb) { @@ -684,7 +684,7 @@ function php_fork_exec(callable $fn, $f_stdout = "/dev/null", $f_stderr = null) * @param array|null $env env * @return array [out, err] */ -function spawn_exec($cmd, $input = null, $tv_sec = null, $tv_usec = null, $cwd = null, array $env = null) +function spawn_exec($cmd, $input = null, $tv_sec = null, $tv_usec = null, $cwd = null, ?array $env = null) { $out = $err = null; $winOpt = ['suppress_errors' => true, 'binary_pipes' => true]; diff --git a/thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c b/thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c index c030abc318b..d74ff5a7a8f 100644 --- a/thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c +++ b/thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c @@ -21,7 +21,6 @@ #include "php.h" #include "ext/pdo/php_pdo_driver.h" -#include "ext/pdo/php_pdo_int.h" #include "ext/pdo/pdo_sql_parser.h" int pdo_pgsql_scanner(pdo_scanner_t *s) diff --git a/thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c b/thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c index 05e702fbd53..442ccb1aff6 100644 --- a/thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c +++ b/thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c @@ -21,7 +21,6 @@ #include "php.h" #include "ext/pdo/php_pdo_driver.h" -#include "ext/pdo/php_pdo_int.h" #include "ext/pdo/pdo_sql_parser.h" int pdo_sqlite_scanner(pdo_scanner_t *s) diff --git a/tools/bootstrap.php b/tools/bootstrap.php index 5486505073f..3a917bb29a2 100755 --- a/tools/bootstrap.php +++ b/tools/bootstrap.php @@ -125,7 +125,7 @@ function swoole_execute_and_check(array $commands): void echo "=========== Finish Done ============" . PHP_EOL . PHP_EOL; } -function scan_dir(string $dir, callable $filter = null): array +function scan_dir(string $dir, ?callable $filter = null): array { $files = array_filter(scandir($dir), function (string $file) { return $file[0] !== '.'; @@ -136,7 +136,7 @@ function scan_dir(string $dir, callable $filter = null): array return array_values($filter ? array_filter($files, $filter) : $files); } -function scan_dir_recursive(string $dir, callable $filter = null): array +function scan_dir_recursive(string $dir, ?callable $filter = null): array { $result = []; $files = scan_dir($dir, $filter);