Skip to content

Populate $_SERVER with $_ENV #571

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
1 commit merged into from
Apr 10, 2019
Merged

Populate $_SERVER with $_ENV #571

1 commit merged into from
Apr 10, 2019

Conversation

nicolas-grekas
Copy link
Member

Q A
License MIT

Reverts #540, fixes #532 (comment)

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@ghost ghost merged commit 2b3e7e2 into symfony:master Apr 10, 2019
ghost pushed a commit that referenced this pull request Apr 10, 2019
@nicolas-grekas nicolas-grekas deleted the env-load branch April 10, 2019 13:40
@MisatoTremor
Copy link
Contributor

While you are right about thread safety this again introduces the problem that a system behaves different after calling composer dump-env prod.

The better solution would be to remove putenv from Dotenv, too. But that's not how it currently is.

@nicolas-grekas
Copy link
Member Author

The better solution would be to remove putenv from Dotenv, too. But that's not how it currently is.

I agree with that but indeed it would be quite a BC break.
Alternatively, you should ensure to always use $_SERVER and never getenv(). It's broken anyway.

@MisatoTremor
Copy link
Contributor

Yep, unfortunately it is in the Symfony doc prior to 4.2, so it might be out in the wild.
Should therefor mainly apply to the 3.3 version of the receipe ... whiiich I coincidentally overlooked in my PR :-\

fabpot added a commit to symfony/symfony that referenced this pull request Apr 10, 2019
This PR was squashed before being merged into the 4.3-dev branch (closes #31062).

Discussion
----------

[Dotenv] Deprecate useage of "putenv"

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | n/a

From discussions on symfony/recipes#571, I think it is a good idea to make people opt-in to using `putenv`.

In Symfony 5.0 we will just change the value of the constructor. As an alternative, we could decide we want to remove `putenv` in Symfony 5.0. If so, I would also deprecate `$usePutenv=true`.

Commits
-------

8e45fc0 [Dotenv] Deprecate useage of \"putenv\"
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use getenv when using .env.local.php
4 participants