Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Process] intersect with getenv() to populate default envs#44070
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedNov 16, 2021
| Q | A |
|---|---|
| Branch? | 4.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#44066 |
| License | MIT |
| Doc PR | - |
Uh oh!
There was an error while loading.Please reload this page.
72c52b9 to77f8f52Compare77f8f52 tof608f0bCompare| $env =getenv(); | ||
| $env =array_intersect_key($env,$_SERVER) ?:$env; |
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 means if the current running process has added env vars putenv(), they still won't be detected though. One has to update $_SERVER + do putenv() for it to be taken into account.
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.
That's right, we are intentionally not compatible with putenv() here, because using putenv leads to blank pages in Windows
| $env = []; | ||
| foreach ($_SERVERas$k =>$v) { | ||
| if (\is_string($v) &&false !==$v =getenv($k)) { |
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.
Removal of the is_string check seems to be allowing arrays to get in to the env array as values. This causes an error "ErrorException Array to string conversion" when the env vars are read as a string in the start() method()
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.
Already fixed, see#44208
Please create issue instead of commenting on closed PRs to report issue btw.