-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fa7594
commit 866a8cf
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
866a8cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very important that makeMutable() is called before load(). It's difficult to explain why, so I made scheme to clearly illustrate the problem:
But by calling makeMutable() first, load() can repopulate $_ENV, even if it's not empty. getenv() is still affected by the reset, but not $_ENV:
I remind that this bug only appears with thread-safe versions of PHP, and if two scripts are executed at the same time.
866a8cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we don't want it to override any existing ENV variables on load, because sometimes we set some in the web server or PHPUnit configuration.
866a8cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change has caused a bug for me where when running my tests, the environment variables specified in phpunit.xml are only set for the first test. After that, my tests are using the environment variables listed in
.env
.866a8cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erf... indeed, makeMutable() may be problematic... so we still have this problem with thread-safe versions of PHP. It's very annoying :(