Skip to content
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

Fix GH-7896: Environment vars may be mangled on Windows #7928

Closed
wants to merge 2 commits into from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Jan 11, 2022

When bug 77574[1] has been fixed, the fix only catered to variables
retrieved via getenv() with a $varname passed, but neither to
getenv() without arguments nor to the general import of environment
variables into $_ENV and $_SERVER. We catch up on this by using
GetEnvironmentStringsW() in _php_import_environment_variables() and
converting the encoding to whatever had been chosen by the user.

[1] https://bugs.php.net/bug.php?id=75574

When bug 77574[1] has been fixed, the fix only catered to variables
retrieved via `getenv()` with a `$varname` passed, but neither to
`getenv()` without arguments nor to the general import of environment
variables into `$_ENV` and `$_SERVER`.  We catch up on this by using
`GetEnvironmentStringsW()` in `_php_import_environment_variables()` and
converting the encoding to whatever had been chosen by the user.

[1] <https://bugs.php.net/bug.php?id=75574>
Apparently, other systems may not properly work with environment
variable names which contain non ASCII characters, so we skip the test
there.
@cmb69 cmb69 closed this in 93a3c71 Jan 17, 2022
@cmb69 cmb69 deleted the cmb/gh7896 branch January 17, 2022 22:49
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.

Env vars with non-ASCII values are mangled when read from $_SERVER on Windows
1 participant