Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed for 8.4 #5537

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/"
Expand Down
4 changes: 2 additions & 2 deletions ext-src/swoole_coroutine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions ext-src/swoole_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions tests/include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
Expand Down
1 change: 0 additions & 1 deletion thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tools/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] !== '.';
Expand All @@ -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);
Expand Down
Loading