1
0
Fork 0

more appropriate name

pull/4805/head
Rob Bast 2016-01-22 09:20:43 +01:00
parent 474541e9aa
commit 2393222826
1 changed files with 3 additions and 5 deletions

View File

@ -644,8 +644,8 @@ class RemoteFilesystem
$targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem'; $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) { if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
$this->safeCopy($result, $targetPath); $this->streamCopy($result, $targetPath);
chmod($targetPath, 0644); chmod($targetPath, 0666);
} }
$defaults['ssl']['cafile'] = $targetPath; $defaults['ssl']['cafile'] = $targetPath;
@ -784,14 +784,12 @@ class RemoteFilesystem
} }
/** /**
* Safely copy a file.
*
* Uses stream_copy_to_stream instead of copy to work around https://bugs.php.net/bug.php?id=64634 * Uses stream_copy_to_stream instead of copy to work around https://bugs.php.net/bug.php?id=64634
* *
* @param string $source * @param string $source
* @param string $target * @param string $target
*/ */
private function safeCopy($source, $target) private function streamCopy($source, $target)
{ {
$source = fopen($source, 'r'); $source = fopen($source, 'r');
$target = fopen($target, 'w+'); $target = fopen($target, 'w+');