Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Ensure final input of CommandTester works with default#29754
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
| $stream =fopen('php://memory','r+',false); | ||
| fwrite($stream,implode(PHP_EOL,$inputs)); | ||
| fwrite($stream,implode(PHP_EOL,$inputs).PHP_EOL); |
nicolas-grekasJan 3, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
When an empty array is passed, this writes a PHP_EOL. Legit?
Should the code be rewritten as such?
foreach ($inputsas$line) {fwrite($stream,$line.PHP_EOL);}
nicolas-grekas left a comment
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.
ping@Simperfit could you review and tell if it's legit to you?
Note that this should target 4.1
chalasr left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Looks good to me (code owner here). 👍 once@nicolas-grekas's comment addressed
Firehed commentedJan 3, 2019
I prefer that approach too. Changed :) |
If the final element of `CommandTester::setInputs()` is an empty string (to send the default value), the internal stream the tester uses hits EOF and triggers the `Aborted` exception. This appends an additional EOL to the stream after the `implode` to simulate one final return key, allowing the final input to use the default value when used in the tester's documented style.
chalasr commentedJan 4, 2019
Rebased on 3.4. Note to mergers: patch needs to be moved to |
chalasr commentedJan 4, 2019
Good catch, thanks@Firehed. |
…rehed)This PR was merged into the 3.4 branch.Discussion----------Ensure final input of CommandTester works with default| Q | A| ------------- | ---| Branch? | 4.x| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -If the final element of `CommandTester::setInputs()` is an empty string (to send the default value), the internal stream the tester uses hits EOF and triggers the `Aborted` exception. This appends an additional EOL to the stream after the `implode` to simulate one final return key, allowing the final input to use the default value when used in the tester's documented style.A test has been added to cover the new behavior, which failed before this change.Commits-------6b87b67 Ensure final input of CommandTester works with default
chalasr commentedJan 4, 2019
And thank you for contributing to Symfony! |
If the final element of
CommandTester::setInputs()is an empty string (to send the default value), the internal stream the tester uses hits EOF and triggers theAbortedexception. This appends an additional EOL to the stream after theimplodeto simulate one final return key, allowing the final input to use the default value when used in the tester's documented style.A test has been added to cover the new behavior, which failed before this change.