Skip to content

Symfony 3.2.5 breaks validation for Console options w/ required values #22050

@greg-1-anderson

Description

@greg-1-anderson
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.5, 3.2.6

In Symfony Console version 3.2.4 and earlier, options with required values were validated correctly. For example:

$ ./robo -f examples/ try:opt-required --foo                                              
  [Symfony\Component\Console\Exception\RuntimeException]  
  The "--foo" option requires a value.                    

In Symfony Console version 3.2.5, this validation step is skipped.

I have verified this in multiple Symfony Console applications, which all break in the same way when upgrading to version 3.2.5.

I have also confirmed that commenting out the line $command->setInputBound(true); in Application.php fixes the symptom. Removing this optimization is not the proposed solution; this is just as far as I got in terms of isolation.

Workaround:

  • Call $input->bind($command->getDefinition()); in an event subscriber (probably not a great idea)
  • Pin Symfony/Console to 3.2.4 in composer.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions