-
Notifications
You must be signed in to change notification settings - Fork 13
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
I should be able to use $_ENV #49
Comments
Putting aside thread safety for a moment, there are other reasons why superglobals including $_ENV are bad when distributing libraries and modules. Previous discussion on this:
tl;dr: PHP has a config setting To the point of thread safety, this wasn't something I was aware of and I agree it's concerning. But vlucas himself comments in the issue discussing thread safety that if this is an issue in production, you're holding it wrong. At least that's my interpretation. In the end, I guess we're balancing a known problem (support tickets generated by inconsistent variables_order and $_ENV usage) against a theoretical one (thread safety). |
It's funny about that linked issue: If you don't load via See v4 to v5 https://github.com/vlucas/phpdotenv/blob/master/UPGRADING.md
You make a good point about |
Also to note: this should probably stay because Drush doesn't pass context to child processes so
So I guess this can be closed. Regardless what may be used outside of Drupal or elsewhere in PHP, |
Thanks for the Drush reference, I vaguely recall that being a problem. I'm a little wigged out by the thread safety issue. But until somewhat demonstrates that actually causing problems, I don't see much choice but to let it go. |
I referenced this thread in the AcquiaPHP ruleset so we can avoid sharding or repeating this discussion: 08dd037 |
Another reason to use putenv, it actually modifies the process environment, unlike |
The latest release prevents using globals. vlucas/phpdotenv encourages using
$_ENV
because it is thread safe. See https://github.com/vlucas/phpdotenv#putenv-and-getenvThe text was updated successfully, but these errors were encountered: