Skip to content

ext/standard: Fix proc_open() crash on macOS older than the build SDK#22607

Open
bukka wants to merge 1 commit into
php:masterfrom
bukka:fix_proc_open_addchdir_macos
Open

ext/standard: Fix proc_open() crash on macOS older than the build SDK#22607
bukka wants to merge 1 commit into
php:masterfrom
bukka:fix_proc_open_addchdir_macos

Conversation

@bukka

@bukka bukka commented Jul 5, 2026

Copy link
Copy Markdown
Member

posix_spawn_file_actions_addchdir() is only available since macOS 26, but the configure link check passes whenever the SDK exports the symbol, so building with the macOS 26 SDK for an older deployment target produces a weakly linked reference that resolves to NULL at runtime and proc_open() crashes when $cwd is used. Pick the variant at runtime via __builtin_available() when the deployment target is older than macOS 26.

posix_spawn_file_actions_addchdir() is only available since macOS 26,
but the configure link check passes whenever the SDK exports the symbol,
so building with the macOS 26 SDK for an older deployment target
produces a weakly linked reference that resolves to NULL at runtime and
proc_open() crashes when $cwd is used. Pick the variant at runtime via
__builtin_available() when the deployment target is older than macOS 26.
@bukka

bukka commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

I found this when testing #22606 as I use newer SDK on older target so run-tests.php was crashing. So this is follow up for #21552

@NattyNarwhal

Copy link
Copy Markdown
Member

There's GH-21722; the approach there is a bit simpler after some reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants