Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Command usage output invalid if argument name is a reserved style #41315

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

Closed
n0rbyt3 opened this issue May 20, 2021 · 1 comment · Fixed by #41386
Closed

[Console] Command usage output invalid if argument name is a reserved style #41315

n0rbyt3 opened this issue May 20, 2021 · 1 comment · Fixed by #41386

Comments

@n0rbyt3
Copy link
Contributor

n0rbyt3 commented May 20, 2021

Symfony version(s) affected: >=4.4

Description
If you name an console input argument "info" and try to use the command without arguments, the help output is incorrect.

How to reproduce

class FooBarCommand extends Command
{
    protected static $defaultName = 'foo:bar';

    protected function configure()
    {
        $this->addArgument('first', InputArgument::REQUIRED);
        $this->addArgument('info', InputArgument::REQUIRED);
        $this->addArgument('last', InputArgument::REQUIRED);
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        return Command::SUCCESS;
    }
}

Command line:

php bin\console foo:bar
[Not anough arguments info]
foo:bar <first> <last>

Possible Solution
Do not print the arguments as tags, use another delimiter instead or the output should not get formatted.

@chalasr
Copy link
Member

chalasr commented Jun 1, 2021

See #41386

nicolas-grekas added a commit that referenced this issue Jun 3, 2021
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Console] Escape synopsis output

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #41315 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

960cb52 [Console] Escape synopsis output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants