Skip to content
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

upgrade.php: If we're on windows, make sure we can load intermediate certificates #15052

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
upgrade.php: If we're on windows, make sure we can load intermediate …
…certificates

According to curl/curl#12155 and curl/curl@2d63331

Some corporate Windows proxy (mis)configurations don't pass along
intermediate certificates in their TLS handshakes, breaking lots of
things that don't work around it.

This creates a problem in our curl calls when checking for
.upgrade_requirements.json, and seems to be the source of errors for a
few of our users: #14826 (comment)

In this change, we detect when running on windows environments and load
the curl option that works around this.
Jeremy Price committed Jul 9, 2024
commit c8fe002688169c8dedb46c94be869407fc2dd3e1
6 changes: 6 additions & 0 deletions upgrade.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@ function url_get_contents ($Url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// If we're on windows, make sure we can load intermediate certificates in
// weird corporate environments.
// See: https://github.com/curl/curl/commit/2d6333101a71129a6a802eb93f84a5ac89e34479
if (PHP_OS == "WINNT"){
curl_setopt($ch, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
}
$output = curl_exec($ch);
curl_close($ch);
return $output;