From f2a69dbb6817e29d85aa9a8e8e4aa4a4498aedf8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2024 09:35:27 +0200 Subject: [PATCH 1/3] Fix #5536 remove unneeded include of php_pdo_int.h --- thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c | 1 - thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c | 1 - 2 files changed, 2 deletions(-) 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) From beed9c31075a27d016a0d262e6d89f002d7dade3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2024 10:45:16 +0200 Subject: [PATCH 3/3] call exit using original function handler --- ext-src/swoole_coroutine.cc | 4 ++-- ext-src/swoole_runtime.cc | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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());