File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 5
5
- Core:
6
6
. Fixed bug #81430 (Attribute instantiation leaves dangling pointer).
7
7
(beberlei)
8
+ . Fixed bug GH-7896 (Environment vars may be mangled on Windows). (cmb)
8
9
9
10
- FFI:
10
11
. Fixed bug GH-7867 (FFI::cast() from pointer to array is broken). (cmb,
Original file line number Diff line number Diff line change @@ -571,11 +571,15 @@ void _php_import_environment_variables(zval *array_ptr)
571
571
import_environment_variable (Z_ARRVAL_P (array_ptr ), * env );
572
572
}
573
573
#else
574
- char * environment = GetEnvironmentStringsA ();
575
- for (char * env = environment ; env != NULL && * env ; env += strlen (env ) + 1 ) {
576
- import_environment_variable (Z_ARRVAL_P (array_ptr ), env );
574
+ wchar_t * environmentw = GetEnvironmentStringsW ();
575
+ for (wchar_t * envw = environmentw ; envw != NULL && * envw ; envw += wcslen (envw ) + 1 ) {
576
+ char * env = php_win32_cp_w_to_any (envw );
577
+ if (env != NULL ) {
578
+ import_environment_variable (Z_ARRVAL_P (array_ptr ), env );
579
+ free (env );
580
+ }
577
581
}
578
- FreeEnvironmentStringsA ( environment );
582
+ FreeEnvironmentStringsW ( environmentw );
579
583
#endif
580
584
581
585
tsrm_env_unlock ();
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-7896 (Environment vars may be mangled on Windows)
3
+ --SKIPIF--
4
+ <?php
5
+ if (PHP_OS_FAMILY !== "Windows " ) die ("skip for Windows only " );
6
+ ?>
7
+ --ENV--
8
+ FÖÖ=GüИter传
9
+ --FILE--
10
+ <?php
11
+ var_dump (
12
+ $ _SERVER ['FÖÖ ' ],
13
+ $ _ENV ['FÖÖ ' ],
14
+ getenv ('FÖÖ ' )
15
+ );
16
+ ?>
17
+ --EXPECT--
18
+ string(11) "GüИter传"
19
+ string(11) "GüИter传"
20
+ string(11) "GüИter传"
You can’t perform that action at this time.
0 commit comments