-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process] Fix pipes handling #18066
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] Fix pipes handling #18066
Conversation
nicolas-grekas
commented
Mar 8, 2016
Q | A |
---|---|
Branch | 2.7 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #18015 |
License | MIT |
Doc PR | - |
Status: needs work |
cdf46af
to
dc1e6b1
Compare
GREEN! |
if (is_resource($input)) { | ||
$this->input = $input; | ||
} elseif (is_string($input)) { | ||
$this->inputBuffer = $input; |
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.
If the string already fits in memory, there is no gain in putting it in a php://temp
stream
} | ||
// Remove extra null chars returned by fread | ||
if ('' !== $data) { | ||
$read[$type] = rtrim($data, "\x00"); |
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.
@romainneutron I can't reproduce trailing nul chars so I removed this. Can you?
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.
This may happen e.g. if you decrypt a string using mcrypt_decrypt
.
Amazing work @nicolas-grekas. I almost got mad when trying to fix this build failure. The change itself looks good but I am not too familiar with how the different systems handle processes. |
$w = array($this->pipes[0]); | ||
|
||
// let's have a look if something changed in streams | ||
if (false === $n = @stream_select($r, $w, $e, 0, 0)) { |
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.
no need to wait here as this is done in readAndWrite
Thank you @nicolas-grekas. |
This PR was merged into the 2.7 branch. Discussion ---------- [Process] Fix pipes handling | Q | A | ------------- | --- | Branch | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18015 | License | MIT | Doc PR | - Commits ------- 3ab6c39 [Process] Fix pipes handling