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
Command: Adding argument called 'command' makes other args/options unreadable #54729
Comments
Reproducible and should concern all versions. In my opinion, the solution should be as @cavias has described. In the simplest case, Of course, it would be nicer if you could also use A separation of argument and command name handling should be possible to a limited extent by taking the position into account during tokenizing (command name is always in the first position). |
I would consider But to be honest, such edge cases exist for sure and we definitely don't want to break them, nor ask them to find another way to solve their need especially as it is likely to be more involving than just renaming That said, if you don't have a real use case I suggest not putting much effort into this and eventually close. |
I ran into this because I wanted to have an argument named "command" because of some custom usecase. But I just changed the argument into some other name as the name of the argument is arbitrary. The main issue I had is that I spend an hour figuring out why my other arguments were failing to register for no obvious reason, only to find this bug. |
Symfony version(s) affected
7.0.6
Description
Adding an argument called "command" to a custom Symfony command seems to conflict with the internal "command" value, making other parameters inaccessible.
There should probably be some filter/fix for this.
How to reproduce
Step 1: Create the following Command (Just add your own namespacing and such):
Step 2: Run
php bin/console some:command whatever thing --cavia=cavia
Possible Solution
In my opinion I should be able to get the 'command' argument as well as the other registered arguments and options.
Or the 'command' should be illegal as custom argument name and produce an Exception for that.
Or the argument 'command' should be handled separately from the internal commandname.
Additional Context
Note: I don't have a usecase for this. I just came across this while testing.
The text was updated successfully, but these errors were encountered: