-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process] Pass the commandline as array to proc_open()
#52409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Process] Pass the commandline as array to proc_open()
#52409
Conversation
The failing unit test in PHP 8.3 seems to be a bug in PHP: php/php-src#12589 |
It is a new feature and must therefore target 7.1 because of feature freeze period Should we wait wait for a PHP bugfix before merge? |
209588c
to
b56c0b0
Compare
Changed the base to 7.0 (there is no 7.1 branch yet)
I think so, yes. |
62a7132
to
185744e
Compare
The PHP bug got closed, the new behavior is intended. I updated the pull request to handle that case. |
proc_open()
4b31327
to
3eca0b9
Compare
|
Hey! Thanks for your PR. You are targeting branch "7.0" but it seems your PR description refers to branch "7.1". Cheers! Carsonbot |
@carsonbot the 7.1 branch does not exist yet. |
$process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); | ||
} finally { | ||
restore_error_handler(); | ||
} | ||
|
||
if (!\is_resource($process)) { | ||
throw new RuntimeException('Unable to launch a new process.'); | ||
throw new RuntimeException('Unable to launch a new process: '.$lastError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw a ProcessFailedException
here? That would improve backwards compatibility I think.
Or should we maybe create a new exception like ProcessStartFailedException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProcessFailedException would be fine to me
Sorry, something went wrong.
All reactions
-
👍 1 reaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a new ProcessStartFailedException
that extends the ProcessFailedException
in 833bf1d.
This is a clean API I think and makes the changed behavior in PHP 8.3 a little bit more BC.
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
Can't we use an array on Windows also? Sorry I didn't read everything 😬
While at it, WDYT of the warnings on appveyor :)
'where' is not recognized as an internal or external command,
operable program or batch file.
'where' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Invalid argument or option - '/usr/local/php/bin/php-invalid'.
Type "WHERE /?" for usage help.
ERROR: Invalid argument or option - '/usr/local/php/bin/php-invalid'.
Type "WHERE /?" for usage help.
Sorry, something went wrong.
All reactions
$process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); | ||
} finally { | ||
restore_error_handler(); | ||
} | ||
|
||
if (!\is_resource($process)) { | ||
throw new RuntimeException('Unable to launch a new process.'); | ||
throw new RuntimeException('Unable to launch a new process: '.$lastError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProcessFailedException would be fine to me
Sorry, something went wrong.
All reactions
-
👍 1 reaction
d603793
to
833bf1d
Compare
41770b7
to
a300de8
Compare
Thank you @ausi. |
All reactions
-
🎉 1 reaction
Sorry, something went wrong.
I don’t think so as we use some heavy |
All reactions
-
👍 1 reaction
Sorry, something went wrong.
Introduced in symfony/symfony#52409 we no longer should use `Illuminate\Support\ProcessUtils::escapeArgument()` unless calling `Process` via `Process::fromShellCommandline()` fixes #51820 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Introduced in symfony/symfony#52409 we no longer should use `Illuminate\Support\ProcessUtils::escapeArgument()` unless calling `Process` via `Process::fromShellCommandline()` fixes #51820 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Introduced in symfony/symfony#52409 we no longer should use `Illuminate\Support\ProcessUtils::escapeArgument()` unless calling `Process` via `Process::fromShellCommandline()` fixes #51820 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
nicolas-grekas
stof
OskarStark
derrabus
chalasr
Successfully merging this pull request may close these issues.
[Process] Allow running multiple commands at once
Since PHP 7.4,
proc_open()
accepts an array which makes it twice as fast (4x as fast with PHP 8.3), see #43162 (comment)This pull request enables calling
proc_open()
with an array if:$this->commandline
is an array--enable-sigchild