From bdd90a49c47500b58f624fdd25eef24022213a43 Mon Sep 17 00:00:00 2001 From: Peter Rehm Date: Sat, 16 Apr 2016 19:15:12 +0200 Subject: [PATCH 1/2] Show channel even if there is no new version on the current channel --- src/Composer/Command/SelfUpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index bec8f705a..c0834e2c8 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -117,7 +117,7 @@ EOT } if (Composer::VERSION === $updateVersion) { - $io->writeError('You are already using composer version '.$updateVersion.'.'); + $io->writeError(sprintf('You are already using composer version %s (%s channel).', $updateVersion, $versionsUtil->getChannel())); // remove all backups except for the most recent, if any if ($input->getOption('clean-backups')) { From d716c73333d72478b58768b7ced44c43972ef356 Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Fri, 1 Apr 2016 01:36:05 +0200 Subject: [PATCH 2/2] fail download on content-length mismatch --- src/Composer/Util/RemoteFilesystem.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index c10bf4d44..56d2a2e68 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -277,6 +277,11 @@ class RemoteFilesystem try { $result = file_get_contents($fileUrl, false, $ctx); + if ($this->bytesMax && strlen($result) < $this->bytesMax) { + // alas, this is not possible via the stream callback because STREAM_NOTIFY_COMPLETED is documented, but not implemented anywhere in PHP + throw new TransportException('Content-Length mismatch'); + } + if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) { // Emulate fingerprint validation on PHP < 5.6 $params = stream_context_get_params($ctx);