Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] invalid default returned from ChoiceQuestion on non interactive mode when using SymfonyStyle #25470

Copy link
Copy link
Closed
@mathroc

Description

@mathroc
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.x

the choice index is returned instead of the choice value when a default choice is specified and the command is executed with -n

the default value is set to the choice index here : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Style/SymfonyStyle.php#L230

so I’ve tried to run $io->askQuestion(new ChoiceQuestion($question, $choices, $default)); directly. it works on non interactive mode but fails on interactive mode

I think ChoiceQuestion should override getDefault() to solve this. I can make a PR for this but will this considered a BC break ? or does it falls in the bug fix category ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.