Skip to content

[Console] Escape question text and default value in SymfonyStyle::ask() #19961

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

Merged
merged 1 commit into from
Oct 5, 2016

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Sep 18, 2016

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #19493
License MIT
Doc PR n/a

@chalasr chalasr force-pushed the console/style/escape_default_value branch from ad76f98 to 84779a1 Compare September 18, 2016 13:48
@chalasr chalasr changed the title [Console] Escape default value in SymfonyStyle::ask() [Console] Escape question text and default value in SymfonyStyle::ask() Sep 18, 2016
@ro0NL
Copy link
Contributor

ro0NL commented Sep 18, 2016

This needs to be done on a per case basis? Ie. case $question instanceof ChoiceQuestion: requires a different approach right?

edit: consider https://github.com/chalasr/symfony/blob/84779a1b4cde11a83ec6c542ccad2e419d4e3c47/src/Symfony/Component/Console/Question/Question.php#L55 vs. https://github.com/chalasr/symfony/blob/84779a1b4cde11a83ec6c542ccad2e419d4e3c47/src/Symfony/Component/Console/Formatter/OutputFormatter.php#L28

$default = $question->getDefault();

if (null !== $default) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be skipped for ConfirmationQuestion, else bool is converted to a string.

@chalasr chalasr force-pushed the console/style/escape_default_value branch 2 times, most recently from d3c1d69 to f37bbbd Compare September 18, 2016 14:38
@chalasr
Copy link
Member Author

chalasr commented Sep 18, 2016

I made the change, refactoring a bit btw so we stop duplications.
If it looks less readable, please say me so I rollback and do the change for each case of the switch that need it.

@ro0NL
Copy link
Contributor

ro0NL commented Sep 18, 2016

Yeah.. i would say revert and escape where needed.

@chalasr chalasr force-pushed the console/style/escape_default_value branch from f37bbbd to eed3cc5 Compare September 18, 2016 15:48
@chalasr
Copy link
Member Author

chalasr commented Sep 18, 2016

Reverted.

@fabpot
Copy link
Member

fabpot commented Oct 5, 2016

Thank you @chalasr.

@fabpot fabpot merged commit eed3cc5 into symfony:2.7 Oct 5, 2016
fabpot added a commit that referenced this pull request Oct 5, 2016
…yStyle::ask() (chalasr)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Escape question text and default value in SymfonyStyle::ask()

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19493
| License       | MIT
| Doc PR        | n/a

Commits
-------

eed3cc5 [Console] Escape default value and question in SymfonyStyle::ask()
@chalasr chalasr deleted the console/style/escape_default_value branch October 5, 2016 07:10
This was referenced Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants