[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Fri, 02 Oct 2026 08:44:49 +0000
Subject: [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141862@lists.php.net to get a copy of this message
Author: Shivam Mathur (shivammathur) Date: 2026-10-02T14:13:06+05:30 Commit: https://github.com/php/php-src/commit/f54f4467ba9205a0aa4c3b572fbbe3f117b7e0ba Raw diff: https://github.com/php/php-src/commit/f54f4467ba9205a0aa4c3b572fbbe3f117b7e0ba.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Backport fixes for macOS 26 (#24031) Changed paths: M Zend/zend_alloc.c M ext/lexbor/config.m4 M ext/standard/config.m4 M ext/standard/proc_open.c Diff: diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f3dfe0f9df57..95986d709cf8 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -3466,12 +3466,14 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void *data, size_t data_size) { #if ZEND_MM_STORAGE - zend_mm_storage tmp_storage, *storage; + zend_mm_storage *storage; + zend_mm_storage tmp_storage = { + .handlers = *handlers, + .data = data, + }; zend_mm_chunk *chunk; zend_mm_heap *heap; - memcpy((zend_mm_handlers*)&tmp_storage.handlers, handlers, sizeof(zend_mm_handlers)); - tmp_storage.data = data; chunk = (zend_mm_chunk*)handlers->chunk_alloc(&tmp_storage, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE); if (UNEXPECTED(chunk == NULL)) { #if ZEND_MM_ERROR diff --git a/ext/lexbor/config.m4 b/ext/lexbor/config.m4 index 21fabcd0ddb0..a75f490e77cc 100644 --- a/ext/lexbor/config.m4 +++ b/ext/lexbor/config.m4 @@ -1,4 +1,4 @@ -PHP_LEXBOR_CFLAGS="-I@ext_srcdir@/" +PHP_LEXBOR_CFLAGS="-Wno-unknown-warning-option -Wno-unterminated-string-initialization -I@ext_srcdir@/" LEXBOR_DIR="lexbor" AC_DEFINE([HAVE_LEXBOR], [1], [Define to 1 if the PHP extension 'lexbor' is available.]) diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index ef6b3c5a0101..1d64c7ff6968 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -328,7 +328,7 @@ dnl PHP_CHECK_FUNC(res_search, resolv, socket) -AC_CHECK_FUNCS([posix_spawn_file_actions_addchdir_np elf_aux_info]) +AC_CHECK_FUNCS([posix_spawn_file_actions_addchdir posix_spawn_file_actions_addchdir_np elf_aux_info]) dnl dnl Obsolete check for strptime() declaration. The strptime, where available, diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index da03160c2771..3a16d2c84f2a 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -35,7 +35,7 @@ #include <fcntl.h> #endif -#ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP +#if defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP) || defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) /* Only defined on glibc >= 2.29, FreeBSD CURRENT, musl >= 1.1.24, * MacOS Catalina or later.. * It should be possible to modify this so it is also @@ -44,7 +44,24 @@ * to be really buggy. */ #include <spawn.h> +#ifdef __APPLE__ +#include <AvailabilityMacros.h> +#endif #define USE_POSIX_SPAWN + +/* The non-_np variant is in macOS 26 (and _np deprecated). On Apple, it has to be selected by the + * deployment target rather than the configure check: the link check passes whenever the SDK + * exports the symbol even if the running system is older, in which case the weakly linked + * reference resolves to NULL at runtime. */ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000 +#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir +#elif defined(__APPLE__) +#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np +#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) +#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir +#else +#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np +#endif #endif /* This symbol is defined in ext/standard/config.m4. @@ -1392,9 +1409,9 @@ PHP_FUNCTION(proc_open) } if (cwd) { - r = posix_spawn_file_actions_addchdir_np(&factions, cwd); + r = POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(&factions, cwd); if (r != 0) { - php_error_docref(NULL, E_WARNING, "posix_spawn_file_actions_addchdir_np() failed: %s", strerror(r)); + php_error_docref(NULL, E_WARNING, ZEND_TOSTR(POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) "() failed: %s", strerror(r)); } }

« previous php.cvs (#141862) next »