|
@@ -904,17 +904,7 @@ class RemoteFilesystem
|
|
|
if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
|
|
|
$result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
|
|
|
|
|
|
- if (preg_match('{^phar://}', $result)) {
|
|
|
- $hash = hash_file('sha256', $result);
|
|
|
- $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
|
|
|
-
|
|
|
- if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
|
|
|
- $this->streamCopy($result, $targetPath);
|
|
|
- chmod($targetPath, 0666);
|
|
|
- }
|
|
|
-
|
|
|
- $defaults['ssl']['cafile'] = $targetPath;
|
|
|
- } elseif (is_dir($result)) {
|
|
|
+ if (is_dir($result)) {
|
|
|
$defaults['ssl']['capath'] = $result;
|
|
|
} else {
|
|
|
$defaults['ssl']['cafile'] = $result;
|
|
@@ -939,24 +929,6 @@ class RemoteFilesystem
|
|
|
return $defaults;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Uses stream_copy_to_stream instead of copy to work around https://bugs.php.net/bug.php?id=64634
|
|
|
- *
|
|
|
- * @param string $source
|
|
|
- * @param string $target
|
|
|
- */
|
|
|
- private function streamCopy($source, $target)
|
|
|
- {
|
|
|
- $source = fopen($source, 'r');
|
|
|
- $target = fopen($target, 'w+');
|
|
|
-
|
|
|
- stream_copy_to_stream($source, $target);
|
|
|
- fclose($source);
|
|
|
- fclose($target);
|
|
|
-
|
|
|
- unset($source, $target);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Fetch certificate common name and fingerprint for validation of SAN.
|
|
|
*
|