Skip to content

[Runtime] Fix --env and --no-debug with dotenv_overload #44997

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

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

With the dotenv_overload option enabled, commands --no-debug and --env=prod options are not honored.

@fancyweb fancyweb force-pushed the runtime/dotenv-overload-cmd branch 2 times, most recently from fb41341 to 97a5714 Compare January 12, 2022 15:25
@fancyweb fancyweb force-pushed the runtime/dotenv-overload-cmd branch from 97a5714 to 0afd743 Compare January 26, 2022 17:31
@fancyweb fancyweb force-pushed the runtime/dotenv-overload-cmd branch from 0afd743 to 0460f81 Compare January 26, 2022 17:32
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit 5bb11d5 into symfony:5.4 Jan 26, 2022
@fancyweb fancyweb deleted the runtime/dotenv-overload-cmd branch January 26, 2022 17:34
This was referenced Jan 28, 2022
nicolas-grekas added a commit that referenced this pull request Feb 15, 2022
This PR was merged into the 5.4 branch.

Discussion
----------

[Runtime] Fix dotenv_overload with commands

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | -
| Tickets       | -
| License       | MIT
| Doc PR        | -

Fixes bugs introduced in #44997.

For example, if `$_SERVER['APP_ENV'] = 'foo';` exists and with `APP_ENV=prod` in `.env`, any command will throw `Cannot use "--env" or "-e" when the...` because `foo` is considered as the input env.

Determining the input env and debug from `$_SERVER` is wrong because when the `--no-debug` and `--env` are not used, we actually consider the existing env and debug as the input end and debug. We need to know and use the real input env and debug.

Commits
-------

4075269 [Runtime] Fix dotenv_overload with commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants