New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix run-script not setting Path correctly on Windows #10700
Conversation
@@ -571,7 +571,7 @@ protected function popEvent(): ?string | |||
private function ensureBinDirIsInPath(): void | |||
{ | |||
$pathEnv = 'PATH'; | |||
if (false === Platform::getEnv('PATH') && false !== Platform::getEnv('Path')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the Platform::getEnv
helper is used for a good reason and should not be removed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Platform::getEnv
will fallback to getenv
which is not case sensitive, making this check moot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's still not right. Env variables may exist in $_SERVER only, and not in putenv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is the code that was used before it was changed to getEnv. I don't really think getenv matters here because on Windows, Path (but not PATH) should exist in $_SERVER. All we're doing is just getting the right capitalization.
Regardless, if you have a better idea on how to fix scripts not running on Windows in 2.3, do suggest it.
I did a bisect on main branch, and it stops working with this commit: d2ede37 which makes me think While that commit is checked out, downgrading back to v2.8.52 makes it work again, upgrading to v3.4.47 breaks. Testing it further, v3.4.2 appears to be the exact version when it broke. |
Thanks, I believe the fix makes sense. Probably could be checked even further by using But I'll merge this now as it is definitely a fix already. |
Fixes #10699.
getenv
is case-insensitive as far as I understand it, which makes it not work correctly.Not entirely sure why it works on 2.2, because the same code should be there.
It was changed here: bd4d624#diff-4ec8bee1b3bdbc03e2097675b4586f3bb92ff70afff4e6ee5e4cc25847816e97L569