Skip to content

Commit

Permalink
Merge 1da292d into d275d27
Browse files Browse the repository at this point in the history
  • Loading branch information
smola committed Aug 2, 2020
2 parents d275d27 + 1da292d commit 5ca9a33
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/PhpBrew/Downloader/PhpStreamDownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace PhpBrew\Downloader;

use RuntimeException;

class PhpStreamDownloader extends BaseDownloader
{
protected function process($url, $targetFilePath)
Expand Down Expand Up @@ -31,13 +33,16 @@ protected function process($url, $targetFilePath)
$context = stream_context_create($opts);
$binary = file_get_contents($url, null, $context);
}
if ($binary !== false) {
file_put_contents($targetFilePath, $binary);
if ($binary === false) {
throw new RuntimeException("Fail to request $url");
}

return true;
$res = file_put_contents($targetFilePath, $binary);
if ($res === false) {
throw new RuntimeException("Failed writing to $targetFilePath");
}
// throw new RuntimeException("Fail to request $url");
return false;

return true;
}

public function hasSupport($requireSsl)
Expand Down

0 comments on commit 5ca9a33

Please sign in to comment.