-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Option -e prod is interpreted as a command when no command is specified #23343
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
Comments
Note that you can set the |
Hi, yes absolutely. In my use case it's more safe to rely on the command parameter. Obviously this is not a major bug. I will try to investigate in the next days. |
It's because of the |
Suggest (also reminder for me): If an option have the mode VALUE_REQUIRED, the argument just after should be attached to its value, if not already an option. |
To avoid this issue you could try this syntax |
Yes, it's true. This is not a big issue, but the console does not behave as it should. In other cases, putting the value after a space is not a problem, so it should be also not here :) |
Even if there are alternative solutions ( |
Indeed, I'll give it a try this week. |
@chalasr did you already implemented it, or could I look into it ? |
Isn't it somehow expected? I guess in such case |
@HeahDude IMO it should be working and return the available command in prod env, like |
@Simperfit I started to look into, the issue starts from ArgvInput::getFirstArgument(). It should consider a space as separator for option values, but it doesn't (considers |
This is the only way I've found at this time to resolve this issue: https://github.com/romain-pierre/symfony/commit/e76a597fb8ef898bc27a62a146cd04f4a2d0b7bc |
@romain-pierre Do you want to create the pull request ? You already did the feature, you may have to add test ;). |
I would like to have an advise from @chalasr before, because I don't know the impact of calling |
👍 for fixing |
Any news? |
For Symfony 4.1, I would recommend to deprecate both |
@romain-pierre Do you want to fix the behaviour for 2.7 to 4.0 ? |
@Simperfit Userland applications can have similar options, the behavior should not be deprecated (only some core global options should be). |
How exactly should I start the
It doesn't seem like you could export the SYMFONY_ENV and then execute the symfony command at all? |
I'm also facing the same problem as @steve-todorov .. can't seem to use the web server bundle .. |
Managed to solve the problem. The problem for me was that I was mixing Symfony 3.4 and 4.0 bundles together. Surprisingly this was not caught by the package manager (composer) as a conflict. After removing the distribution-bundle, all other bundles got correctly upgraded to correct versions. |
I have the same issue, that i can't set the environment through the command line option. Works fine: Works fine too: Fails with "There are no commands defined in the "app" namespace.": To set this by an environment variable is no option for me, because my command-line-tool should run twice on the same machine. One version in dev and the other in prod. I am using symfony 4.1.3. |
@LinkingYou you can set env variables for each call too |
I think this issue can be closed since #28653 |
#28653 has been reverted, re-opening. |
Having |
Unless one opts in to a different meaning by using the proposed extra argument. I'd really prefer no hard coded special edge case btw. |
…ning an option value (chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Prevent ArgvInput::getFirstArgument() from returning an option value | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23343 | License | MIT | Doc PR | n/a Fixes the case where the passed input string contains no command name but one or more global (i.e. application-defined) options accepting values. Commits ------- 46461e9 [Console] Prevent ArgvInput::getFirstArgument() from returning an option value
I usually use the short command
bin/console
to list all available options. But on a production server, I have to set the env option to avoid default dev environment and missing debug vendors.But, if I type only
bin/console -e prod
the command report the following error:As soon as I set a command, there is no problem (for example
bin/console list -e prod
. The wordprod
is interpreted as the command instead of the value of the-e
option.The text was updated successfully, but these errors were encountered: