mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-7896: Environment vars may be mangled on Windows
This commit is contained in:
commit
8d2ed194bf
3 changed files with 29 additions and 4 deletions
|
@ -571,11 +571,15 @@ void _php_import_environment_variables(zval *array_ptr)
|
|||
import_environment_variable(Z_ARRVAL_P(array_ptr), *env);
|
||||
}
|
||||
#else
|
||||
char *environment = GetEnvironmentStringsA();
|
||||
for (char *env = environment; env != NULL && *env; env += strlen(env) + 1) {
|
||||
import_environment_variable(Z_ARRVAL_P(array_ptr), env);
|
||||
wchar_t *environmentw = GetEnvironmentStringsW();
|
||||
for (wchar_t *envw = environmentw; envw != NULL && *envw; envw += wcslen(envw) + 1) {
|
||||
char *env = php_win32_cp_w_to_any(envw);
|
||||
if (env != NULL) {
|
||||
import_environment_variable(Z_ARRVAL_P(array_ptr), env);
|
||||
free(env);
|
||||
}
|
||||
}
|
||||
FreeEnvironmentStringsA(environment);
|
||||
FreeEnvironmentStringsW(environmentw);
|
||||
#endif
|
||||
|
||||
tsrm_env_unlock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue