Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Process] Use correct test for empty string in UnixPipes#11264
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
given that the previous code always ensure$data is a string, I don't see the point of this change
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.
Sometimes$data is'0' thus making this if condition false. I was using$data !== '' but I noticed that in WindowsPipes similar check to this one is used
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'd prefer'' !== $data
romainneutron commentedJul 2, 2014
I just tested this PR and tests don't pass, they're hanging on the while ('' !==$dataread = (string)fread($pipe,self::CHUNK_SIZE)) { Please also add a unit test, I think it's easily doable within the dataProvider of Last but not least, this patch should come in 2.3 (data is fetched this way in this version too), I'll manage to port the update in other versions |
whs commentedJul 3, 2014
Unit test added and tests passed. |
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 works correctly in bash, however in does not work in sh (-n option does not exist). PHP might wrap commands with sh and results with-n 0 as output (for example on my laptop).
You can useprintf 0 which result in the same output and is much more compatible I think.
romainneutron commentedJul 9, 2014
👍 With a note for myself : merge this in 2.3 |
romainneutron commentedJul 12, 2014
ping @symfony/deciders Anybody against/in favor of this one ? |
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.
Why notfalse !== $dataread = fread($pipe, self::CHUNK_SIZE)?
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.
nvm, I found the answer in the previous coomments.
jakzal commentedJul 12, 2014
👍 |
1 similar comment
fabpot commentedJul 12, 2014
👍 |
romainneutron commentedJul 12, 2014
This PR is not mergeable in 2.3 using gh, I supersede it in#11381 |
…ipes (whs, romainneutron)This PR was merged into the 2.3 branch.Discussion----------[2.3] [Process] Use correct test for empty string in UnixPipes| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aThis PR supersedes#11264 : 2.3 compatibility + Windows compatibility + CS fixCommits-------cec0a45 [Process] Adjust PR#11264, make it Windows compatible and fix CS9e1ea4a [Process] Use correct test for empty string in UnixPipes
* 2.3: [Process] Adjust PR#11264, make it Windows compatible and fix CS [Process] Fix unit tests on Windows platform bumped Symfony version to 2.3.19 updated VERSION for 2.3.18 update CONTRIBUTORS for 2.3.18 updated CHANGELOG for 2.3.18 [Process] Use correct test for empty string in UnixPipesConflicts:src/Symfony/Component/HttpKernel/Kernel.phpsrc/Symfony/Component/Process/Tests/AbstractProcessTest.php
* 2.4: [Process] Adjust PR#11264, make it Windows compatible and fix CS [Process] Fix unit tests on Windows platform bumped Symfony version to 2.4.9 bumped Symfony version to 2.3.19 updated VERSION for 2.4.8 updated CHANGELOG for 2.4.8 updated VERSION for 2.3.18 update CONTRIBUTORS for 2.3.18 updated CHANGELOG for 2.3.18 [Process] Use correct test for empty string in UnixPipesConflicts:src/Symfony/Component/HttpKernel/Kernel.php
* 2.5: [Process] Adjust PR#11264, make it Windows compatible and fix CS [Process] Fix unit tests on Windows platform bumped Symfony version to 2.5.3 bumped Symfony version to 2.4.9 bumped Symfony version to 2.3.19 updated VERSION for 2.5.2 updated CHANGELOG for 2.5.2 updated VERSION for 2.4.8 updated CHANGELOG for 2.4.8 [2.5][Form] solved dependency to ValidatorInterface,fix#11036 updated VERSION for 2.3.18 update CONTRIBUTORS for 2.3.18 updated CHANGELOG for 2.3.18 [Process] Use correct test for empty string in UnixPipesConflicts:src/Symfony/Component/HttpKernel/Kernel.phpsrc/Symfony/Component/Process/ProcessPipes.php
…romainneutron)This PR was merged into the 2.3 branch.Discussion----------fix signal handling in wait() on calls to stop()| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#11286| License | MIT| Doc PR |``wait()`` throws an exception when the process was terminated by a signal. This should not happen when the termination was requested by calling the ``stop()`` method (for example, inside a callback which is passed to ``wait()``).Commits-------5939d34 [Process] Fix unit tests in sigchild environmenteb68662 [Process] fix signal handling in wait()94ffc4f bug#11469 [BrowserKit] Fixed server HTTP_HOST port uri conversion (bcremer, fabpot)103fd88 [BrowserKit] refactor code and fix unquoted regexf401ab9 Fixed server HTTP_HOST port uri conversion045cbc5 bug#11425 Fix issue described in#11421 (Ben, ben-rosio)f5bfa9b bug#11423 Pass a Scope instance instead of a scope name when cloning a container in the GrahpvizDumper (jakzal)3177be5 minor#11464 [Translator] Use quote to surround invalid locale (lyrixx)c9742ef [Translator] Use quote to surround invalid locale4dbe0e1 bug#11120 [2.3][Process] Reduce I/O load on Windows platform (romainneutron)797d814 bug#11342 [2.3][Form] Check if IntlDateFormatter constructor returned a valid object before using it (romainneutron)0b5348e minor#11441 [Translator] Optimize assertLocale regexp (Jérémy Derussé)537c39b Optimize assertLocale regexp4cf50e8 Bring code into standard9f4313c [Process] Add test to verify fix for issue#1142102eb765 [Process] Fixes issue#114216787669 [DependencyInjection] Pass a Scope instance instead of a scope name.9572918 bug#11411 [Validator] Backported#11410 to 2.3: Object initializers are called only once per object (webmozart)291cbf9 [Validator] Backported#11410 to 2.3: Object initializers are called only once per objectefab884 bug#11403 [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator (takeit)3176f8b [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator91e32f8 bug#11381 [2.3] [Process] Use correct test for empty string in UnixPipes (whs, romainneutron)45df2f3 minor#11397 [2.3][Process] Fix unit tests on Windows platform (romainneutron)cec0a45 [Process] Adjust PR#11264, make it Windows compatible and fix CSd418935 [Process] Fix unit tests on Windows platformff0bb01 [Process] Reduce I/O load on Windows platformace5a29 bumped Symfony version to 2.3.1975e07e6 updated VERSION for 2.3.184a12f4d update CONTRIBUTORS for 2.3.1898b891d updated CHANGELOG for 2.3.1806a80fb Validate locales sets intos translator06fc97e feature#11367 [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses... (CVE-2014-4671) (Andrew Moore)3c54659 minor#11387 [2.3] [Validator] Fix UserPassword validator translation (redstar504)73d50ed Fix UserPassword validator translation93a970c bug#11386 Remove Spaceless Blocks from Twig Form Templates (chrisguitarguy)8f9ed3e Remove Spaceless Blocks from Twig Form Templates9e1ea4a [Process] Use correct test for empty string in UnixPipes6af3d05 [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses (PreventsCVE-2014-4671)ebf967d [Form] Check if IntlDateFormatter constructor returned a valid object before using it
* upstream/master: (1619 commits) fixed CS [Translator] Use quote to surround invalid locale Allow exception bubbling in RememberMeListener [FrameworkBundle] improved controller name parse error message [DomCrawler] Added node name getter [Validator] Fixed memory leak in ValidatorBuilder [FrameworkBundle] changed KernelTestCase::getKernelClass() to check $_SERVER['KERNEL_DIR'] before invoking getPhpUnitXmlDir() [Validator] Improve UserPassword message Optimize assertLocale regexp [ExpressionLanguage] Fixed an issue with # characters in double quoted string literals [Validator] Fixed object initializers in 2.5 version of the Validator [Console] Fix test on windows Add some tweaks to the pt_BR translations [Validator] Backportedsymfony#11410 to 2.3: Object initializers are called only once per object Rename Specificity->compare() to compareTo() [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator fixed CS Add compare method to Specificity [Process] Adjust PRsymfony#11264, make it Windows compatible and fix CS [Process] Fix unit tests on Windows platform ...
Process sometimes omit
0as the test use PHP's equality to check read string. This PR correctly check for empty string.Fix for
masterbranch also available in this repository.