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
Fix macOS posix_spawn_file_actions_addchdir availability handling
  • Loading branch information
arshidkv12 committed Apr 13, 2026
commit f1e3800a2b49312d8c99efd234ee33e1a6daa075
36 changes: 14 additions & 22 deletions ext/standard/proc_open.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
| Copyright © The PHP Group and Contributors. |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
| This source file is subject to the Modified BSD License that is |
| bundled with this package in the file LICENSE, and is available |
| through the World Wide Web at <https://www.php.net/license/>. |
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
Expand Down Expand Up @@ -44,29 +42,23 @@
* 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) */
#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED <= 260000

#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np

#elif defined(__APPLE__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 26000

#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir

#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)

#elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 260000
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np
#elif 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.
* Essentially, it is set if you HAVE_FORK || PHP_WIN32
* Other platforms may modify that configure check and add suitable #ifdefs
Expand Down Expand Up @@ -1586,4 +1578,4 @@ PHP_FUNCTION(proc_open)
}
/* }}} */

#endif /* PHP_CAN_SUPPORT_PROC_OPEN */
#endif /* PHP_CAN_SUPPORT_PROC_OPEN */
Loading