forked from php/php-src
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix phpGH-7896: Environment vars may be mangled on Windows
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>
- Loading branch information
Showing
2 changed files
with
24 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
GH-7896 (Environment vars may be mangled on Windows) | ||
--ENV-- | ||
FÖÖ=GüИter传 | ||
--FILE-- | ||
<?php | ||
var_dump( | ||
$_SERVER['FÖÖ'], | ||
$_ENV['FÖÖ'], | ||
getenv('FÖÖ') | ||
); | ||
?> | ||
--EXPECT-- | ||
string(11) "GüИter传" | ||
string(11) "GüИter传" | ||
string(11) "GüИter传" |