Win32 CreateProcess requires "[that] all strings in the environment block must be sorted alphabetically by name. The sort is case-insensitive, Unicode order, without regard to locale." according to https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx
One real impact that we have observed from this, is when you use a QProcess to launch a program that then uses ::ShellExecute to open a URL. When ::ShellExecute is requested to open an URL it will prepend the URL to the url handling program (the browser for http URLs), but it will fail to notice the existing Path variable if the sorting of the environment block is wrong. The consequence is that you end with an environment with two Path variables, which can break browser plugins and extensions.
Experiment that demonstrates this issue:
Launch this program from another program via QProcess:
Before running open-open-slashdot-in-browser make sure your browser is not running so single-instancing doesn't ruin the experiment. Then run open-open-slashdot-in-browser. When the browser window pops up there is a good chance the process has two Path variables. This can be checked with process explorer (procexp64.exe). Close the browser and launch open-slashdot-in-browser directly. The opened browser process should now only have one Path environment variable.
|For Gerrit Dashboard: QTBUG-61315|
|196852,11||Use QMap in QProcessEnvironment so variables are sorted||5.9||qt/qtbase||Status: MERGED||+2||0|
|197011,3||Rename QProcessEnvironmentPrivate::hash to vars||5.9||qt/qtbase||Status: MERGED||+2||0|