Skip to content

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

Closed
cmb69 wants to merge 2 commits into
php:PHP-8.0from
cmb69:cmb/gh7896
Closed

cmb69 wants to merge 2 commits into
php:PHP-8.0from
cmb69:cmb/gh7896

Conversation

@cmb69

@cmb69 cmb69 commented Jan 11, 2022

Copy link
Copy Markdown
Member

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