Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: composer/composer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.10.9
Choose a base ref
...
head repository: composer/composer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.10.10
Choose a head ref

Commits on Jul 16, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    1189207 View commit details
  2. Supply event dispatcher in Create Project Command

    This update allows composer plugins to intercept the
    create-project command to inject additional functionality such as
    providing additional remote filesystem handling.
    Shaun Johnston committed Jul 16, 2020
    Copy the full SHA
    b4ecca5 View commit details
  3. Remove cygwin php handling in UAC elevation

    When called from a native shell and using cygwin PHP, cygpath translates
    `/tmp` to `User\AppData\Local\Temp`, rather than `/cygdrive/.../tmp`.
    This change does not affect using windows PHP from a Cygwin shell.
    johnstevenson committed Jul 16, 2020
    Copy the full SHA
    8ddbae3 View commit details

Commits on Jul 17, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    1d3af13 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    eac03e1 View commit details
  3. Update deps

    Seldaek committed Jul 17, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    ff7f9dc View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    a474dee View commit details

Commits on Jul 21, 2020

  1. Fix: Reference

    localheinz committed Jul 21, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    localheinz Andreas Möller
    Copy the full SHA
    ac055e5 View commit details

Commits on Jul 22, 2020

  1. Merge pull request #9065 from localheinz/fix/reference

    Fix: Reference
    Seldaek authored Jul 22, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5fceb47 View commit details

Commits on Jul 26, 2020

  1. Properly support PHP 8.0 Named Arguments

    See https://wiki.php.net/rfc/named_params#internal_functions
    (implemented but not yet merged)
    
    An ArgumentCountError will be thrown when passing variadic arguments to
    a function with call_user_func_array() if extra unknown named arguments
    are encountered.
    
    Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in phar:///path/to/composer.phar/src/Composer/DependencyResolver/DefaultPolicy.php:84
    
    (e.g. for `['phpunit/phpunit' => [72]]`)
    TysonAndre committed Jul 26, 2020
    Copy the full SHA
    e5c7835 View commit details

Commits on Jul 27, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    b25296e View commit details

Commits on Jul 29, 2020

  1. Unverified

    The email in this signature doesn’t match the committer email.
    Copy the full SHA
    404dea6 View commit details

Commits on Jul 30, 2020

  1. Check that class exists

    lstrojny committed Jul 30, 2020

    Unverified

    The email in this signature doesn’t match the committer email.
    Copy the full SHA
    5a02ea6 View commit details
  2. Merge pull request #9076 from TysonAndre/named-arguments-bugfix

    Properly support PHP 8.0 Named Arguments (Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters)
    Seldaek authored Jul 30, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    868aa10 View commit details
  3. Merge pull request #9085 from lstrojny/lib-cldr

    Allow specifying a version requirement for CLDR
    Seldaek authored Jul 30, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    daae46e View commit details
  4. Merge pull request #9077 from glaubinix/f/api-data-detection

    Driver: only cache composer.json file without API data to disk
    Seldaek authored Jul 30, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7028d0c View commit details
  5. Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    5bd61ac View commit details
  6. Promote next major version when running stable self-update, and preve…

    …nt self-update from automatically upgrading to the next major release
    Seldaek committed Jul 30, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    387e828 View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    00f712a View commit details
  8. Merge pull request #9092 from composer/revert-9085-lib-cldr

    Revert "Allow specifying a version requirement for CLDR"
    Seldaek authored Jul 30, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    393acc7 View commit details

Commits on Aug 3, 2020

  1. Update changelog

    Seldaek committed Aug 3, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    b112f90 View commit details
  2. Release 1.10.10

    Seldaek committed Aug 3, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    Seldaek Jordi Boggiano
    Copy the full SHA
    32966a3 View commit details
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -56,3 +56,20 @@ jobs:
asset_path: ./composer.phar
asset_name: composer.phar
asset_content_type: application/octet-stream

# This step requires a secret token with `pull` access to composer/docker. The default
# secrets.GITHUB_TOKEN is scoped to this repository only which is not sufficient.
- name: "Open issue @ Docker repository"
uses: actions/github-script@v2
with:
github-token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
script: |
// github.ref value looks like 'refs/tags/TAG', cleanup
const tag = "${{ github.ref }}".replace(/refs\/tags\//, '');
// create new issue on Docker repository
github.issues.create({
owner: "${{ github.repository_owner }}",
repo: "docker",
title: `New Composer tag: ${ tag }`,
body: `https://github.com/${{ github.repository }}/releases/tag/${ tag }`,
});
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### [1.10.10] 2020-08-03

* Fixed `create-project` not triggering events while installing the root package
* Fixed PHP 8 compatibility issue
* Fixed `self-update` to avoid automatically upgrading to the next major version once it becomes stable

### [1.10.9] 2020-07-16

* Fixed Bitbucket redirect loop when credentials are outdated
@@ -873,6 +879,7 @@

* Initial release

[1.10.10]: https://github.com/composer/composer/compare/1.10.9...1.10.10
[1.10.9]: https://github.com/composer/composer/compare/1.10.8...1.10.9
[1.10.8]: https://github.com/composer/composer/compare/1.10.7...1.10.8
[1.10.7]: https://github.com/composer/composer/compare/1.10.6...1.10.7
101 changes: 60 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 9 additions & 16 deletions src/Composer/Command/CreateProjectCommand.php
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
use Composer\Config\JsonConfigSource;
use Composer\Util\Filesystem;
use Composer\Package\Version\VersionParser;
use Composer\EventDispatcher\EventDispatcher;

/**
* Install a package as new project into new directory.
@@ -286,10 +287,14 @@ protected function installRootPackage(IOInterface $io, Config $config, $packageN
$config->merge(array('config' => array('secure-http' => false)));
}

$composer = Factory::create($io, $config->all(), $disablePlugins);
$config = $composer->getConfig();
$rm = $composer->getRepositoryManager();

if (null === $repository) {
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
} else {
$sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
$sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true, $rm);
}

$parser = new VersionParser();
@@ -384,13 +389,13 @@ protected function installRootPackage(IOInterface $io, Config $config, $packageN
$package = $package->getAliasOf();
}

$dm = $this->createDownloadManager($io, $config);
$dm = $composer->getDownloadManager();
$dm->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setOutputProgress(!$noProgress);

$projectInstaller = new ProjectInstaller($directory, $dm);
$im = $this->createInstallationManager();
$im = $composer->getInstallationManager();
$im->addInstaller($projectInstaller);
$im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
$im->notifyInstalls($io);
@@ -408,16 +413,4 @@ protected function installRootPackage(IOInterface $io, Config $config, $packageN

return $installedFromVcs;
}

protected function createDownloadManager(IOInterface $io, Config $config)
{
$factory = new Factory();

return $factory->createDownloadManager($io, $config);
}

protected function createInstallationManager()
{
return new InstallationManager();
}
}
68 changes: 38 additions & 30 deletions src/Composer/Command/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
@@ -135,8 +135,36 @@ protected function execute(InputInterface $input, OutputInterface $output)

$latest = $versionsUtil->getLatest();
$latestStable = $versionsUtil->getLatest('stable');
try {
$latestPreview = $versionsUtil->getLatest('preview');
} catch (\UnexpectedValueException $e) {
$latestPreview = $latestStable;
}
$latestVersion = $latest['version'];
$updateVersion = $input->getArgument('version') ?: $latestVersion;
$currentMajorVersion = preg_replace('{^(\d+).*}', '$1', Composer::getVersion());
$updateMajorVersion = preg_replace('{^(\d+).*}', '$1', $updateVersion);
$previewMajorVersion = preg_replace('{^(\d+).*}', '$1', $latestPreview['version']);

if ($versionsUtil->getChannel() === 'stable' && !$input->getArgument('version')) {
// if requesting stable channel and no specific version, avoid automatically upgrading to the next major
// simply output a warning that the next major stable is available and let users upgrade to it manually
if ($currentMajorVersion < $updateMajorVersion) {
$skippedVersion = $updateVersion;

$versionsUtil->setChannel($currentMajorVersion);

$latest = $versionsUtil->getLatest();
$latestStable = $versionsUtil->getLatest('stable');
$latestVersion = $latest['version'];
$updateVersion = $latestVersion;

$io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://github.com/composer/composer/releases for changelogs.</warning>');
} elseif ($currentMajorVersion < $previewMajorVersion) {
// promote next major version if available in preview
$io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');
}
}

if ($requestedChannel && is_numeric($requestedChannel) && substr($latestStable['version'], 0, 1) !== $requestedChannel) {
$io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$requestedChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
@@ -380,8 +408,8 @@ protected function setLocalPhar($localFilename, $newFilename, $backupTarget = nu
// see if we can run this operation as an Admin on Windows
if (!is_writable(dirname($localFilename))
&& $io->isInteractive()
&& $this->isWindowsNonAdminUser($isCygwin)) {
return $this->tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin);
&& $this->isWindowsNonAdminUser()) {
return $this->tryAsWindowsAdmin($localFilename, $newFilename);
}

$action = 'Composer '.($backupTarget ? 'update' : 'rollback');
@@ -467,20 +495,16 @@ protected function validatePhar($pharFile, &$error)
/**
* Returns true if this is a non-admin Windows user account
*
* @param null|bool $isCygwin Set by method
* @return bool
*/
protected function isWindowsNonAdminUser(&$isCygwin)
protected function isWindowsNonAdminUser()
{
$isCygwin = preg_match('/cygwin/i', php_uname());

if (!$isCygwin && !Platform::isWindows()) {
if (!Platform::isWindows()) {
return false;
}

// fltmc.exe manages filter drivers and errors without admin privileges
$command = sprintf('%sfltmc.exe filters', $isCygwin ? 'cmd.exe /c ' : '');
exec($command, $output, $exitCode);
exec('fltmc.exe filters', $output, $exitCode);

return $exitCode !== 0;
}
@@ -492,10 +516,9 @@ protected function isWindowsNonAdminUser(&$isCygwin)
*
* @param string $localFilename The composer.phar location
* @param string $newFilename The downloaded or backup phar
* @param bool $isCygwin Whether we are running on Cygwin
* @return bool Whether composer.phar has been updated
*/
protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin)
protected function tryAsWindowsAdmin($localFilename, $newFilename)
{
$io = $this->getIO();

@@ -515,15 +538,9 @@ protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin)

$checksum = hash_file('sha256', $newFilename);

// format the file names for cmd.exe
if ($isCygwin) {
$source = exec(sprintf("cygpath -w '%s'", $newFilename));
$destination = exec(sprintf("cygpath -w '%s'", $localFilename));
} else {
// cmd's internal move is fussy about backslashes
$source = str_replace('/', '\\', $newFilename);
$destination = str_replace('/', '\\', $localFilename);
}
// cmd's internal move is fussy about backslashes
$source = str_replace('/', '\\', $newFilename);
$destination = str_replace('/', '\\', $localFilename);

$vbs = <<<EOT
Set UAC = CreateObject("Shell.Application")
@@ -532,16 +549,7 @@ protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin)
EOT;

file_put_contents($script, $vbs);

if ($isCygwin) {
chmod($script, 0755);
$cygscript = sprintf('"%s"', exec(sprintf("cygpath -w '%s'", $script)));
$command = sprintf("cmd.exe /c '%s'", $cygscript);
} else {
$command = sprintf('"%s"', $script);
}

exec($command);
exec('"'.$script.'"');
@unlink($script);

// see if the file was moved
8 changes: 4 additions & 4 deletions src/Composer/Composer.php
Original file line number Diff line number Diff line change
@@ -50,10 +50,10 @@ class Composer
* const RELEASE_DATE = '@release_date@';
* const SOURCE_VERSION = '1.8-dev+source';
*/
const VERSION = '@package_version@';
const BRANCH_ALIAS_VERSION = '@package_branch_alias_version@';
const RELEASE_DATE = '@release_date@';
const SOURCE_VERSION = '1.10-dev+source';
const VERSION = '1.10.10';
const BRANCH_ALIAS_VERSION = '';
const RELEASE_DATE = '2020-08-03 11:35:19';
const SOURCE_VERSION = '';

/**
* Version number of the internal composer-runtime-api package
2 changes: 1 addition & 1 deletion src/Composer/DependencyResolver/DefaultPolicy.php
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ public function selectPreferredPackages(Pool $pool, array $installedMap, array $
$literals = $this->pruneRemoteAliases($pool, $literals);
}

$selected = call_user_func_array('array_merge', $packages);
$selected = call_user_func_array('array_merge', array_values($packages));

// now sort the result across all packages to respect replaces across packages
usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
2 changes: 1 addition & 1 deletion src/Composer/Installer.php
Original file line number Diff line number Diff line change
@@ -1679,7 +1679,7 @@ public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
* restrict the update operation to a few packages, all other packages
* that are already installed will be kept at their current version
*
* @deprecated use setAllowList instead
* @deprecated use setUpdateAllowList instead
*
* @param array $packages
* @return Installer
10 changes: 6 additions & 4 deletions src/Composer/Repository/RepositoryFactory.php
Original file line number Diff line number Diff line change
@@ -62,11 +62,11 @@ public static function configFromString(IOInterface $io, Config $config, $reposi
* @param bool $allowFilesystem
* @return RepositoryInterface
*/
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null)
{
$repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);

return static::createRepo($io, $config, $repoConfig);
return static::createRepo($io, $config, $repoConfig, $rm);
}

/**
@@ -75,9 +75,11 @@ public static function fromString(IOInterface $io, Config $config, $repository,
* @param array $repoConfig
* @return RepositoryInterface
*/
public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null)
{
$rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
if (!$rm) {
$rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
}
$repos = static::createRepos($rm, array($repoConfig));

return reset($repos);
14 changes: 7 additions & 7 deletions src/Composer/Repository/Vcs/BitbucketDriver.php
Original file line number Diff line number Diff line change
@@ -119,10 +119,14 @@ public function getComposerInformation($identifier)

if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res);
}
$composer = JsonFile::parseJson($res);
} else {
$composer = $this->getBaseComposerInformation($identifier);

$composer = $this->getBaseComposerInformation($identifier);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}

if ($composer) {
// specials for bitbucket
@@ -173,10 +177,6 @@ public function getComposerInformation($identifier)
}

$this->infoCache[$identifier] = $composer;

if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}

return $this->infoCache[$identifier];
14 changes: 7 additions & 7 deletions src/Composer/Repository/Vcs/GitHubDriver.php
Original file line number Diff line number Diff line change
@@ -150,10 +150,14 @@ public function getComposerInformation($identifier)

if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res);
}
$composer = JsonFile::parseJson($res);
} else {
$composer = $this->getBaseComposerInformation($identifier);

$composer = $this->getBaseComposerInformation($identifier);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}

if ($composer) {
// specials for github
@@ -172,10 +176,6 @@ public function getComposerInformation($identifier)
}
}

if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}

$this->infoCache[$identifier] = $composer;
}

16 changes: 8 additions & 8 deletions src/Composer/Repository/Vcs/GitLabDriver.php
Original file line number Diff line number Diff line change
@@ -130,10 +130,14 @@ public function getComposerInformation($identifier)

if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res);
}
$composer = JsonFile::parseJson($res);
} else {
$composer = $this->getBaseComposerInformation($identifier);

$composer = $this->getBaseComposerInformation($identifier);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}

if ($composer) {
// specials for gitlab (this data is only available if authentication is provided)
@@ -145,10 +149,6 @@ public function getComposerInformation($identifier)
}
}

if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}

$this->infoCache[$identifier] = $composer;
}

@@ -446,7 +446,7 @@ protected function getContents($url, $fetchingRepoData = false)
if (!$moreThanGuestAccess) {
$this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');

return $this->attemptCloneFallback();
return $this->attemptCloneFallback();
}
}

26 changes: 18 additions & 8 deletions src/Composer/SelfUpdate/Versions.php
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ class Versions
private $rfs;
private $config;
private $channel;
private $versionsData;

public function __construct(Config $config, RemoteFilesystem $rfs)
{
@@ -63,20 +64,29 @@ public function setChannel($channel)

public function getLatest($channel = null)
{
if ($this->config->get('disable-tls') === true) {
$protocol = 'http';
} else {
$protocol = 'https';
}

$versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
$versions = $this->getVersionsData();

foreach ($versions[$channel ?: $this->getChannel()] as $version) {
if ($version['min-php'] <= PHP_VERSION_ID) {
return $version;
}
}

throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
}

private function getVersionsData()
{
if (!$this->versionsData) {
if ($this->config->get('disable-tls') === true) {
$protocol = 'http';
} else {
$protocol = 'https';
}

$this->versionsData = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
}

return $this->versionsData;
}
}