From 548c76fa39de36f5c1962e852c6143fe78b5d37e Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Fri, 27 Sep 2024 12:49:17 +0200 Subject: [PATCH] Add PHP 8.4 fixes --- patches/cli_checks_84.patch | 13 ----------- ...macos_iconv.patch => macos_iconv_80.patch} | 0 patches/macos_iconv_81.patch | 23 +++++++++++++++++++ patches/macos_iconv_82.patch | 23 +++++++++++++++++++ patches/macos_iconv_83.patch | 23 +++++++++++++++++++ patches/macos_iconv_84.patch | 21 +++++++++++++++++ patches/static_extensions_win32_84.patch | 20 ++++++++-------- 7 files changed, 101 insertions(+), 22 deletions(-) rename patches/{macos_iconv.patch => macos_iconv_80.patch} (100%) create mode 100644 patches/macos_iconv_81.patch create mode 100644 patches/macos_iconv_82.patch create mode 100644 patches/macos_iconv_83.patch create mode 100644 patches/macos_iconv_84.patch diff --git a/patches/cli_checks_84.patch b/patches/cli_checks_84.patch index 3cb2de9..6b8ac74 100644 --- a/patches/cli_checks_84.patch +++ b/patches/cli_checks_84.patch @@ -64,19 +64,6 @@ index 8d45b2ae41..35e9403a31 100644 || strcmp(sapi_module.name, "phpdbg") == 0); if (!sapi_requires_preload_user) { -diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c -index ac0ad2c378..ac1381a4ee 100644 ---- a/ext/pcre/php_pcre.c -+++ b/ext/pcre/php_pcre.c -@@ -305,7 +305,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */ - - /* If we're on the CLI SAPI, there will only be one request, so we don't need the - * cache to survive after RSHUTDOWN. */ -- pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0; -+ pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0; - if (!pcre_globals->per_request_cache) { - zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1); - } diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c index 49a477998b..18fe71cce4 100644 --- a/ext/pdo_sqlite/pdo_sqlite.c diff --git a/patches/macos_iconv.patch b/patches/macos_iconv_80.patch similarity index 100% rename from patches/macos_iconv.patch rename to patches/macos_iconv_80.patch diff --git a/patches/macos_iconv_81.patch b/patches/macos_iconv_81.patch new file mode 100644 index 0000000..b8c7a32 --- /dev/null +++ b/patches/macos_iconv_81.patch @@ -0,0 +1,23 @@ +diff --git a/build/php.m4 b/build/php.m4 +index 01b8250598..0a8c5fba53 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + + dnl Check libc first if no path is provided in --with-iconv. + if test "$PHP_ICONV" = "yes"; then +- dnl Reset LIBS temporarily as it may have already been included -liconv in. +- LIBS_save="$LIBS" +- LIBS= ++ LIBS="$LIBS -liconv" + AC_CHECK_FUNC(iconv, [ + found_iconv=yes + ],[ +@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + found_iconv=yes + ]) + ]) +- LIBS="$LIBS_save" + fi + + dnl Check external libs for iconv funcs. diff --git a/patches/macos_iconv_82.patch b/patches/macos_iconv_82.patch new file mode 100644 index 0000000..b8c7a32 --- /dev/null +++ b/patches/macos_iconv_82.patch @@ -0,0 +1,23 @@ +diff --git a/build/php.m4 b/build/php.m4 +index 01b8250598..0a8c5fba53 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + + dnl Check libc first if no path is provided in --with-iconv. + if test "$PHP_ICONV" = "yes"; then +- dnl Reset LIBS temporarily as it may have already been included -liconv in. +- LIBS_save="$LIBS" +- LIBS= ++ LIBS="$LIBS -liconv" + AC_CHECK_FUNC(iconv, [ + found_iconv=yes + ],[ +@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + found_iconv=yes + ]) + ]) +- LIBS="$LIBS_save" + fi + + dnl Check external libs for iconv funcs. diff --git a/patches/macos_iconv_83.patch b/patches/macos_iconv_83.patch new file mode 100644 index 0000000..b8c7a32 --- /dev/null +++ b/patches/macos_iconv_83.patch @@ -0,0 +1,23 @@ +diff --git a/build/php.m4 b/build/php.m4 +index 01b8250598..0a8c5fba53 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1963,9 +1963,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + + dnl Check libc first if no path is provided in --with-iconv. + if test "$PHP_ICONV" = "yes"; then +- dnl Reset LIBS temporarily as it may have already been included -liconv in. +- LIBS_save="$LIBS" +- LIBS= ++ LIBS="$LIBS -liconv" + AC_CHECK_FUNC(iconv, [ + found_iconv=yes + ],[ +@@ -1974,7 +1972,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + found_iconv=yes + ]) + ]) +- LIBS="$LIBS_save" + fi + + dnl Check external libs for iconv funcs. diff --git a/patches/macos_iconv_84.patch b/patches/macos_iconv_84.patch new file mode 100644 index 0000000..c362e39 --- /dev/null +++ b/patches/macos_iconv_84.patch @@ -0,0 +1,21 @@ +diff --git a/build/php.m4 b/build/php.m4 +index e45b22b766..506be904f1 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1821,15 +1821,12 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + + dnl Check libc first if no path is provided in --with-iconv. + AS_VAR_IF([PHP_ICONV], [yes], [ +- dnl Reset LIBS temporarily as it may have already been included -liconv in. +- LIBS_save=$LIBS +- LIBS= ++ LIBS="$LIBS -liconv" + AC_CHECK_FUNC([iconv], [found_iconv=yes], + [AC_CHECK_FUNC([libiconv], [ + AC_DEFINE([HAVE_LIBICONV], [1]) + found_iconv=yes + ])]) +- LIBS=$LIBS_save + ]) + + dnl Check external libs for iconv funcs. diff --git a/patches/static_extensions_win32_84.patch b/patches/static_extensions_win32_84.patch index f3b7e06..3da8dcc 100644 --- a/patches/static_extensions_win32_84.patch +++ b/patches/static_extensions_win32_84.patch @@ -11,21 +11,23 @@ index c7d897c1ca..d6f7cec5e2 100644 ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo"); } diff --git a/ext/openssl/config.w32 b/ext/openssl/config.w32 -index 76e3079e50..b6fd2c7755 100644 +index 24064ec2a5..87ff31618c 100644 --- a/ext/openssl/config.w32 +++ b/ext/openssl/config.w32 -@@ -1,12 +1,12 @@ +@@ -1,6 +1,6 @@ // vim:ft=javascript -ARG_WITH("openssl", "OpenSSL support", "no,shared"); +ARG_WITH("openssl", "OpenSSL support", "no"); - if (PHP_OPENSSL != "no") { + ARG_WITH("openssl-legacy-provider", "OPENSSL: Load legacy algorithm provider in addition to default provider", "no"); + +@@ -10,7 +10,7 @@ if (PHP_OPENSSL != "no") { var ret = SETUP_OPENSSL("openssl", PHP_OPENSSL); - if (ret > 0) { -- EXTENSION("openssl", "openssl.c xp_ssl.c"); -+ EXTENSION("openssl", "openssl.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); - AC_DEFINE("HAVE_OPENSSL_EXT", 1, "Define to 1 if the openssl extension is available."); - } - } + if (ret >= 2) { +- EXTENSION("openssl", "openssl.c openssl_pwhash.c xp_ssl.c"); ++ EXTENSION("openssl", "openssl.c openssl_pwhash.c xp_ssl.c", PHP_OPENSSL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); + AC_DEFINE("HAVE_OPENSSL_EXT", 1, "Define to 1 if the PHP extension 'openssl' is available."); + if (PHP_OPENSSL_LEGACY_PROVIDER != "no") { + AC_DEFINE("LOAD_OPENSSL_LEGACY_PROVIDER", 1, "Define to 1 to load the OpenSSL legacy algorithm provider in addition to the default provider.");