Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix macOS posix_spawn_file_actions_addchdir availability handling
  • Loading branch information
arshidkv12 committed Apr 13, 2026
commit c4bb7ab1ef1f73a4c232ec1e13a8a23eaeecab98
23 changes: 8 additions & 15 deletions ext/standard/proc_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,17 @@
#define USE_POSIX_SPAWN

/* The non-_np variant is in macOS 26 (and _np deprecated) */
#if defined(__APPLE__) && defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) && \
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000
#define USE_ADDCHDIR posix_spawn_file_actions_addchdir
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000
#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
#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir
#else
#define USE_ADDCHDIR posix_spawn_file_actions_addchdir_np
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np
#endif

static inline int php_spawn_addchdir(
posix_spawn_file_actions_t *factions,
const char *cwd
) {
return USE_ADDCHDIR(factions, cwd);
}

#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(f, d) \
php_spawn_addchdir((f), (d))

#endif

/* This symbol is defined in ext/standard/config.m4.
* Essentially, it is set if you HAVE_FORK || PHP_WIN32
Expand Down
Loading