Skip to content

Stop SIGPIPE from failing the macOS PHP verification step - #4890

Merged
wojtekn merged 4 commits into
trunkfrom
fix-php-verify-sigpipe
Sep 18, 2026
Merged

wojtekn merged 4 commits into
trunkfrom
fix-php-verify-sigpipe

Conversation

@wojtekn

@wojtekn wojtekn commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code diagnosed the failure and wrote the fix. I reviewed the diff.

Proposed Changes

The Verify preinstalled PHP for static-php-cli step added in #4889 fails on macos-x86_64 with:

Required PHP extension missing: mbstring.

That message is wrong — mbstring is present on the runner image. The check itself was broken.

php -m | grep -qix mbstring lets grep exit the moment it matches, which closes the pipe while php -m is still writing. PHP is killed by SIGPIPE and exits 255. Because the step runs under set -o pipefail, the pipeline inherits that failure even though grep succeeded. Reproduced locally on a PHP that definitely has mbstring:

PIPESTATUS=255 0    # php killed by SIGPIPE, grep matched fine

It tripped on mbstring and not zlib purely because of ordering: mbstring appears near the top of php -m and zlib near the bottom, so only the mbstring match leaves enough unwritten output to trigger SIGPIPE. That asymmetry is what made it read like a genuine missing-extension result.

The module list is now captured once and matched against in the loop, so nothing is piped out of php and there is no early-closed pipe.

Testing Instructions

Verified locally by extracting the step from the workflow and running it under the same shell GitHub uses (/bin/bash --noprofile --norc -e -o pipefail):

  • with the real mbstring zlib list → exits 0 and prints php -v / composer --version
  • with a bogus extension name → still exits 1 with Required PHP extension missing: …, so the check hasn't been defanged

End to end, dispatch Build PHP CLI Binaries from this branch with apps_cdn_visibility: none:

gh workflow run build-php-cli-binaries.yml --ref fix-php-verify-sigpipe \
  -f php_version=8.4.25 -f package_version=studio-2 \
  -f xdebug_version=3.5.3 -f apps_cdn_visibility=none

Expect all five targets green.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

wojtekn and others added 4 commits September 18, 2026 15:14
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts:
#	.github/workflows/build-php-cli-binaries.yml
@wojtekn
wojtekn requested a review from a team as a code owner September 18, 2026 14:09
@wojtekn
wojtekn merged commit 48dfaec into trunk Sep 18, 2026
14 checks passed
@wojtekn
wojtekn deleted the fix-php-verify-sigpipe branch September 18, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant