From 293b38bc9db23573a7fa28e5c86c0cfdac8b5341 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Sat, 11 Apr 2026 13:51:11 +0530 Subject: [PATCH 1/2] Fix macOS posix_spawn_file_actions_addchdir availability handling --- ext/standard/proc_open.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index ddce144161ca2..304d3e519995a 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -47,11 +47,26 @@ #define USE_POSIX_SPAWN /* The non-_np variant is in macOS 26 (and _np deprecated) */ -#ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR -#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir +static inline int php_spawn_addchdir( + posix_spawn_file_actions_t *factions, + const char *cwd +) { +#if defined(__APPLE__) + if (__builtin_available(macOS 26.0, *)) { + return posix_spawn_file_actions_addchdir(factions, cwd); + } else { + return posix_spawn_file_actions_addchdir_np(factions, cwd); + } +#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) + return posix_spawn_file_actions_addchdir(factions, cwd); #else -#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np + return posix_spawn_file_actions_addchdir_np(factions, cwd); #endif +} + +#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(f, d) \ + php_spawn_addchdir((f), (d)) + #endif /* This symbol is defined in ext/standard/config.m4. From d8a3e82bb0c39671688119da76a8d66fba509cb9 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Sat, 11 Apr 2026 14:02:09 +0530 Subject: [PATCH 2/2] Fix macOS posix_spawn_file_actions_addchdir availability handling --- ext/standard/proc_open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 304d3e519995a..9807aa08a4907 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -51,7 +51,7 @@ static inline int php_spawn_addchdir( posix_spawn_file_actions_t *factions, const char *cwd ) { -#if defined(__APPLE__) +#if defined(__APPLE__) && defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) if (__builtin_available(macOS 26.0, *)) { return posix_spawn_file_actions_addchdir(factions, cwd); } else {