Skip to content
Open
Changes from 2 commits
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
21 changes: 18 additions & 3 deletions ext/standard/proc_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Copy Markdown
Member

@NattyNarwhal NattyNarwhal Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be able to be simplified by checking __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__/__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ instead, since we don't need any real runtime differences, it's just a symbol name, and the old one is unlikely to go away right now even if it's deprecated. It should respect -mmacosx-version-min as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

posix_spawn_file_actions_t *factions,
const char *cwd
) {
#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 {
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.
Expand Down
Loading