Fix PhpHelpers::checkCode crash when PHP binary path contains spaces#415
Merged
dg merged 9 commits intonette:masterfrom Apr 9, 2026
Merged
Conversation
proc_open with a string command goes through the shell, which splits the path at spaces. This breaks on macOS with Laravel Herd where PHP_BINARY is e.g. /Users/.../Application Support/Herd/bin/php84. Using an array bypasses the shell entirely, which is also what the existing bypass_shell option was intended to do (but only works on Windows).
9ae546d to
1c83b08
Compare
Member
|
thanks |
dg
pushed a commit
that referenced
this pull request
Apr 9, 2026
#415) proc_open with a string command goes through the shell, which splits the path at spaces. This breaks on macOS with Laravel Herd where PHP_BINARY is e.g. /Users/.../Application Support/Herd/bin/php84. Using an array bypasses the shell entirely, which is also what the existing bypass_shell option was intended to do (but only works on Windows).
dg
pushed a commit
that referenced
this pull request
Apr 22, 2026
#415) proc_open with a string command goes through the shell, which splits the path at spaces. This breaks on macOS with Laravel Herd where PHP_BINARY is e.g. /Users/.../Application Support/Herd/bin/php84. Using an array bypasses the shell entirely, which is also what the existing bypass_shell option was intended to do (but only works on Windows).
dg
pushed a commit
that referenced
this pull request
Apr 22, 2026
#415) proc_open with a string command goes through the shell, which splits the path at spaces. This breaks on macOS with Laravel Herd where PHP_BINARY is e.g. /Users/.../Application Support/Herd/bin/php84. Using an array bypasses the shell entirely, which is also what the existing bypass_shell option was intended to do (but only works on Windows).
dg
pushed a commit
that referenced
this pull request
Apr 22, 2026
…nary path (#415) proc_open with a string command goes through the shell, which splits the path at spaces. Using an array bypasses the shell entirely, which is also what the existing bypass_shell option was intended to do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PhpHelpers::checkCodepasses the PHP binary path toproc_openas a concatenated string:On macOS with Laravel Herd,
PHP_BINARYresolves to a path containing spaces:The shell splits this at the space, resulting in exit code 127 (
No such file or directory), empty stdout, and then a crash at line 271:This affects the Latte linter (
Latte\Tools\Linter) which enables the PHP linter viaenablePhpLinter(PHP_BINARY).Fix
Pass an array to
proc_openinstead of a string. This bypasses the shell entirely, avoiding word-splitting. This is also what the existingbypass_shelloption was intended to do, but that only works on Windows — the array form works on all platforms.