diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 32fb186f9..67ee6057d 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -50,6 +50,10 @@ abstract class FileDownloader implements DownloaderInterface echo 'Downloading '.$url.' to '.$fileName.PHP_EOL; + if (0 === strpos($url, 'https:') && !extension_loaded('openssl')) { + throw new \RuntimeException('You must enable the openssl extension to download files via https'); + } + copy($url, $fileName); if (!file_exists($fileName)) { diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 53e30b808..0861737f4 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -36,6 +36,10 @@ class GitDownloader implements DownloaderInterface throw new \InvalidArgumentException('The given package is missing reference information'); } + if (!extension_loaded('openssl')) { + throw new \RuntimeException('You must enable the openssl extension to clone git repositories'); + } + $url = escapeshellarg($package->getSourceUrl()); $ref = escapeshellarg($package->getSourceReference()); system(sprintf('git clone %s %s && cd %2$s && git reset --hard %s', $url, $path, $ref));