From 3b63e5aa128f48872e219fad4389b3f4c7c6fb0f Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Wed, 25 Dec 2024 13:18:52 +0100 Subject: [PATCH 1/2] fix: 8.4 CLI on windows --- .../{cli_static.patch => cli_static_80.patch} | 0 patches/cli_static_81.patch | 25 +++++++++++++++++++ patches/cli_static_82.patch | 25 +++++++++++++++++++ patches/cli_static_83.patch | 25 +++++++++++++++++++ patches/cli_static_84.patch | 23 +++++++++++++++++ 5 files changed, 98 insertions(+) rename patches/{cli_static.patch => cli_static_80.patch} (100%) create mode 100644 patches/cli_static_81.patch create mode 100644 patches/cli_static_82.patch create mode 100644 patches/cli_static_83.patch create mode 100644 patches/cli_static_84.patch diff --git a/patches/cli_static.patch b/patches/cli_static_80.patch similarity index 100% rename from patches/cli_static.patch rename to patches/cli_static_80.patch diff --git a/patches/cli_static_81.patch b/patches/cli_static_81.patch new file mode 100644 index 0000000..a38c97d --- /dev/null +++ b/patches/cli_static_81.patch @@ -0,0 +1,25 @@ +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +index 0ad53e813c..a8cc1bee29 100644 +--- a/sapi/cli/php_cli.c ++++ b/sapi/cli/php_cli.c +@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; + + #if defined(PHP_WIN32) + #if defined(ZTS) +-ZEND_TSRMLS_CACHE_DEFINE() ++//ZEND_TSRMLS_CACHE_DEFINE() + #endif + static DWORD orig_cp = 0; + #endif +@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) + #endif + { + #if defined(PHP_WIN32) ++ php_win32_init_gettimeofday(); ++ if (!php_win32_ioutil_init()) { ++ fprintf(stderr, "ioutil initialization failed"); ++ return 1; ++ } + # ifdef PHP_CLI_WIN32_NO_CONSOLE + int argc = __argc; + char **argv = __argv; diff --git a/patches/cli_static_82.patch b/patches/cli_static_82.patch new file mode 100644 index 0000000..a38c97d --- /dev/null +++ b/patches/cli_static_82.patch @@ -0,0 +1,25 @@ +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +index 0ad53e813c..a8cc1bee29 100644 +--- a/sapi/cli/php_cli.c ++++ b/sapi/cli/php_cli.c +@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; + + #if defined(PHP_WIN32) + #if defined(ZTS) +-ZEND_TSRMLS_CACHE_DEFINE() ++//ZEND_TSRMLS_CACHE_DEFINE() + #endif + static DWORD orig_cp = 0; + #endif +@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) + #endif + { + #if defined(PHP_WIN32) ++ php_win32_init_gettimeofday(); ++ if (!php_win32_ioutil_init()) { ++ fprintf(stderr, "ioutil initialization failed"); ++ return 1; ++ } + # ifdef PHP_CLI_WIN32_NO_CONSOLE + int argc = __argc; + char **argv = __argv; diff --git a/patches/cli_static_83.patch b/patches/cli_static_83.patch new file mode 100644 index 0000000..a38c97d --- /dev/null +++ b/patches/cli_static_83.patch @@ -0,0 +1,25 @@ +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +index 0ad53e813c..a8cc1bee29 100644 +--- a/sapi/cli/php_cli.c ++++ b/sapi/cli/php_cli.c +@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; + + #if defined(PHP_WIN32) + #if defined(ZTS) +-ZEND_TSRMLS_CACHE_DEFINE() ++//ZEND_TSRMLS_CACHE_DEFINE() + #endif + static DWORD orig_cp = 0; + #endif +@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) + #endif + { + #if defined(PHP_WIN32) ++ php_win32_init_gettimeofday(); ++ if (!php_win32_ioutil_init()) { ++ fprintf(stderr, "ioutil initialization failed"); ++ return 1; ++ } + # ifdef PHP_CLI_WIN32_NO_CONSOLE + int argc = __argc; + char **argv = __argv; diff --git a/patches/cli_static_84.patch b/patches/cli_static_84.patch new file mode 100644 index 0000000..90d8b31 --- /dev/null +++ b/patches/cli_static_84.patch @@ -0,0 +1,23 @@ +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +--- a/sapi/cli/php_cli.c (revision d3bf67d44102869f340a7be0e12f4f09de0edbcf) ++++ b/sapi/cli/php_cli.c (date 1735128770216) +@@ -98,7 +98,7 @@ + + #if defined(PHP_WIN32) + #if defined(ZTS) +-ZEND_TSRMLS_CACHE_DEFINE() ++//ZEND_TSRMLS_CACHE_DEFINE() + #endif + static DWORD orig_cp = 0; + #endif +@@ -1137,6 +1137,10 @@ + #endif + { + #if defined(PHP_WIN32) ++ if (!php_win32_ioutil_init()) { ++ fprintf(stderr, "ioutil initialization failed"); ++ return 1; ++ } + # ifdef PHP_CLI_WIN32_NO_CONSOLE + int argc = __argc; + char **argv = __argv; From ae56e02abe8175f7e9278e396eaf36191d8f5039 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Jan 2025 09:20:20 +0800 Subject: [PATCH 2/2] Remove redundant patch files --- patches/cli_static_81.patch | 25 ------------------------- patches/cli_static_82.patch | 25 ------------------------- patches/cli_static_83.patch | 25 ------------------------- 3 files changed, 75 deletions(-) delete mode 100644 patches/cli_static_81.patch delete mode 100644 patches/cli_static_82.patch delete mode 100644 patches/cli_static_83.patch diff --git a/patches/cli_static_81.patch b/patches/cli_static_81.patch deleted file mode 100644 index a38c97d..0000000 --- a/patches/cli_static_81.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c -index 0ad53e813c..a8cc1bee29 100644 ---- a/sapi/cli/php_cli.c -+++ b/sapi/cli/php_cli.c -@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; - - #if defined(PHP_WIN32) - #if defined(ZTS) --ZEND_TSRMLS_CACHE_DEFINE() -+//ZEND_TSRMLS_CACHE_DEFINE() - #endif - static DWORD orig_cp = 0; - #endif -@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) - #endif - { - #if defined(PHP_WIN32) -+ php_win32_init_gettimeofday(); -+ if (!php_win32_ioutil_init()) { -+ fprintf(stderr, "ioutil initialization failed"); -+ return 1; -+ } - # ifdef PHP_CLI_WIN32_NO_CONSOLE - int argc = __argc; - char **argv = __argv; diff --git a/patches/cli_static_82.patch b/patches/cli_static_82.patch deleted file mode 100644 index a38c97d..0000000 --- a/patches/cli_static_82.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c -index 0ad53e813c..a8cc1bee29 100644 ---- a/sapi/cli/php_cli.c -+++ b/sapi/cli/php_cli.c -@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; - - #if defined(PHP_WIN32) - #if defined(ZTS) --ZEND_TSRMLS_CACHE_DEFINE() -+//ZEND_TSRMLS_CACHE_DEFINE() - #endif - static DWORD orig_cp = 0; - #endif -@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) - #endif - { - #if defined(PHP_WIN32) -+ php_win32_init_gettimeofday(); -+ if (!php_win32_ioutil_init()) { -+ fprintf(stderr, "ioutil initialization failed"); -+ return 1; -+ } - # ifdef PHP_CLI_WIN32_NO_CONSOLE - int argc = __argc; - char **argv = __argv; diff --git a/patches/cli_static_83.patch b/patches/cli_static_83.patch deleted file mode 100644 index a38c97d..0000000 --- a/patches/cli_static_83.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c -index 0ad53e813c..a8cc1bee29 100644 ---- a/sapi/cli/php_cli.c -+++ b/sapi/cli/php_cli.c -@@ -97,7 +97,7 @@ PHPAPI extern char *php_ini_scanned_files; - - #if defined(PHP_WIN32) - #if defined(ZTS) --ZEND_TSRMLS_CACHE_DEFINE() -+//ZEND_TSRMLS_CACHE_DEFINE() - #endif - static DWORD orig_cp = 0; - #endif -@@ -1160,6 +1160,11 @@ int main(int argc, char *argv[]) - #endif - { - #if defined(PHP_WIN32) -+ php_win32_init_gettimeofday(); -+ if (!php_win32_ioutil_init()) { -+ fprintf(stderr, "ioutil initialization failed"); -+ return 1; -+ } - # ifdef PHP_CLI_WIN32_NO_CONSOLE - int argc = __argc; - char **argv = __argv;