Merge branch 'master' into 2.0

Update deps
main
Jordi Boggiano 5 years ago
commit 88b051c96b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -37,7 +37,7 @@ matrix:
- php: 7.4snapshot
before_install:
# disable xdebug if available
# disable Xdebug if available
- phpenv config-rm xdebug.ini || echo "xdebug not available"
# disable default memory limit
- export INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

@ -252,7 +252,7 @@
* Fixed output inconsistencies
* Fixed unicode handling in `init` command for author names
* Fixed useless warning when doing partial updates/removes on packages that are not currently installed
* Fixed xdebug disabling issue when combined with disable_functions and allow_url_fopen CLI overrides
* Fixed Xdebug disabling issue when combined with disable_functions and allow_url_fopen CLI overrides
### [1.4.1] - 2017-03-10
@ -313,7 +313,7 @@
* Added `gitlab-token` auth config for GitLab private tokens
* Added `--strict` to the `outdated` command to return a non-zero exit code when there are outdated packages
* Added ability to call php scripts using the current php interpreter (instead of finding php in PATH by default) in script handlers via `@php ...`
* Added `COMPOSER_ALLOW_XDEBUG` env var to circumvent the xdebug-disabling behavior
* Added `COMPOSER_ALLOW_XDEBUG` env var to circumvent the Xdebug-disabling behavior
* Added `COMPOSER_MIRROR_PATH_REPOS` env var to force mirroring of path repositories vs symlinking
* Added `COMPOSER_DEV_MODE` env var that is set by Composer to forward the dev mode to script handlers
* Fixed support for git 2.11

@ -13,7 +13,7 @@ use Composer\XdebugHandler\XdebugHandler;
error_reporting(-1);
// Restart without xdebug
// Restart without Xdebug
$xdebug = new XdebugHandler('Composer', '--ansi');
$xdebug->check();
unset($xdebug);

@ -31,10 +31,10 @@
"psr/log": "^1.0",
"seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0",
"symfony/console": "^2.7 || ^3.0 || ^4.0",
"symfony/filesystem": "^2.7 || ^3.0 || ^4.0",
"symfony/finder": "^2.7 || ^3.0 || ^4.0",
"symfony/process": "^2.7 || ^3.0 || ^4.0",
"symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"react/promise": "^1.2 || ^2.7"
},
"conflict": {

389
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "280f5d5184039085b5f22236d267ae82",
"content-hash": "7fb7edae7611d2e07d946d75b9cf2c63",
"packages": [
{
"name": "composer/ca-bundle",
@ -45,21 +45,7 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
"keywords": [
"cabundle",
"cacert",
"certificate",
"ssl",
"tls"
],
"time": "2019-08-30T08:44:50+00:00"
},
{
@ -98,30 +84,7 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Nils Adermann",
"email": "naderman@naderman.de",
"homepage": "http://www.naderman.de"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
},
{
"name": "Rob Bast",
"email": "rob.bast@gmail.com",
"homepage": "http://robbast.nl"
}
],
"description": "Semver library that offers utilities, version constraint parsing and validation.",
"keywords": [
"semantic",
"semver",
"validation",
"versioning"
],
"time": "2019-03-19T17:25:45+00:00"
},
{
@ -159,51 +122,29 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Nils Adermann",
"email": "naderman@naderman.de",
"homepage": "http://www.naderman.de"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
},
{
"name": "Rob Bast",
"email": "rob.bast@gmail.com",
"homepage": "http://robbast.nl"
}
],
"description": "SPDX licenses list and validation library.",
"keywords": [
"license",
"spdx",
"validator"
],
"time": "2019-07-29T10:31:59+00:00"
},
{
"name": "composer/xdebug-handler",
"version": "1.3.3",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/xdebug-handler.git",
"reference": "46867cbf8ca9fb8d60c506895449eb799db1184f"
"reference": "cbe23383749496fe0f373345208b79568e4bc248"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f",
"reference": "46867cbf8ca9fb8d60c506895449eb799db1184f",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248",
"reference": "cbe23383749496fe0f373345208b79568e4bc248",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0",
"php": "^5.3.2 || ^7.0 || ^8.0",
"psr/log": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
"phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8"
},
"type": "library",
"autoload": {
@ -221,32 +162,37 @@
"email": "john-stevenson@blueyonder.co.uk"
}
],
"description": "Restarts a process without xdebug.",
"description": "Restarts a process without Xdebug.",
"keywords": [
"Xdebug",
"performance"
],
"time": "2019-05-27T17:52:04+00:00"
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/1.4.0"
},
"time": "2019-11-06T16:40:04+00:00"
},
{
"name": "justinrainbow/json-schema",
"version": "5.2.8",
"version": "5.2.9",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
"reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4"
"reference": "44c6787311242a979fa15c704327c20e7221a0e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4",
"reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/44c6787311242a979fa15c704327c20e7221a0e4",
"reference": "44c6787311242a979fa15c704327c20e7221a0e4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.2.20",
"friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1",
"json-schema/json-schema-test-suite": "1.2.0",
"phpunit/phpunit": "^4.8.35"
},
@ -292,20 +238,24 @@
"json",
"schema"
],
"time": "2019-01-14T23:55:14+00:00"
"support": {
"issues": "https://github.com/justinrainbow/json-schema/issues",
"source": "https://github.com/justinrainbow/json-schema/tree/5.2.9"
},
"time": "2019-09-25T14:49:45+00:00"
},
{
"name": "psr/log",
"version": "1.1.0",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
"shasum": ""
},
"require": {
@ -314,7 +264,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
@ -339,7 +289,10 @@
"psr",
"psr-3"
],
"time": "2018-11-20T15:27:04+00:00"
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.2"
},
"time": "2019-11-01T11:05:21+00:00"
},
{
"name": "react/promise",
@ -376,27 +329,21 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2016-03-07T13:46:50+00:00"
},
{
"name": "seld/jsonlint",
"version": "1.7.1",
"version": "1.7.2",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
"reference": "d15f59a67ff805a44c50ea0516d2341740f81a38"
"reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38",
"reference": "d15f59a67ff805a44c50ea0516d2341740f81a38",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/e2e5d290e4d2a4f0eb449f510071392e00e10d19",
"reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19",
"shasum": ""
},
"require": {
@ -432,7 +379,11 @@
"parser",
"validator"
],
"time": "2018-01-24T12:46:19+00:00"
"support": {
"issues": "https://github.com/Seldaek/jsonlint/issues",
"source": "https://github.com/Seldaek/jsonlint/tree/1.7.2"
},
"time": "2019-10-24T14:27:39+00:00"
},
{
"name": "seld/phar-utils",
@ -466,21 +417,12 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be"
}
],
"description": "PHAR file format utilities, for when PHP phars you up",
"keywords": [
"phra"
],
"time": "2015-10-13T18:44:15+00:00"
},
{
"name": "symfony/console",
"version": "v2.8.50",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
@ -537,6 +479,9 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/console/tree/v2.8.52"
},
"time": "2018-11-20T15:55:20+00:00"
},
{
@ -594,11 +539,14 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/debug/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00"
},
{
"name": "symfony/filesystem",
"version": "v2.8.50",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@ -644,11 +592,14 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v2.8.52"
},
"time": "2018-11-11T11:18:13+00:00"
},
{
"name": "symfony/finder",
"version": "v2.8.50",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -693,6 +644,9 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00"
},
{
@ -733,24 +687,8 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2019-08-06T08:03:45+00:00"
},
{
@ -791,30 +729,13 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
},
{
"name": "symfony/process",
"version": "v2.8.50",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
@ -859,6 +780,9 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00"
}
],
@ -915,6 +839,10 @@
"constructor",
"instantiate"
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/master"
},
"time": "2015-06-14T21:17:01+00:00"
},
{
@ -958,12 +886,6 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2016-01-25T08:17:30+00:00"
},
{
@ -1006,27 +928,8 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2019-10-03T11:07:50+00:00"
},
{
@ -1089,6 +992,11 @@
"testing",
"xunit"
],
"support": {
"irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2"
},
"time": "2015-10-06T15:47:00+00:00"
},
{
@ -1123,19 +1031,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2017-11-27T13:52:08+00:00"
},
{
@ -1165,18 +1062,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
},
{
@ -1214,18 +1101,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
},
{
@ -1264,17 +1141,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2017-12-04T08:55:13+00:00"
},
{
@ -1347,6 +1215,10 @@
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.36"
},
"time": "2017-06-21T08:07:12+00:00"
},
{
@ -1390,19 +1262,9 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"abandoned": true,
"time": "2015-10-02T06:51:40+00:00"
},
{
@ -1442,31 +1304,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-01-29T09:50:25+00:00"
},
{
@ -1504,21 +1343,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2017-05-22T07:24:03+00:00"
},
{
@ -1569,6 +1395,10 @@
"environment",
"hhvm"
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/1.3"
},
"time": "2016-08-18T05:49:44+00:00"
},
{
@ -1608,34 +1438,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-06-17T09:04:28+00:00"
},
{
@ -1676,17 +1480,8 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12T03:26:01+00:00"
},
{
@ -1724,20 +1519,6 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-10-03T07:41:43+00:00"
@ -1766,20 +1547,13 @@
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21T13:59:46+00:00"
},
{
"name": "symfony/yaml",
"version": "v2.8.50",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
@ -1825,6 +1599,9 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v2.8.52"
},
"time": "2018-11-11T11:18:13+00:00"
}
],

@ -808,6 +808,10 @@ If set to 1, this env disables the warning about running commands as root/super
It also disables automatic clearing of sudo sessions, so you should really only set this
if you use Composer as super user at all times like in docker containers.
### COMPOSER_ALLOW_XDEBUG
If set to 1, this env allows running Composer when the Xdebug extension is enabled, without restarting PHP without it.
### COMPOSER_AUTH
The `COMPOSER_AUTH` var allows you to set up authentication as an environment variable.
@ -833,6 +837,10 @@ By default it points to `$COMPOSER_HOME/cache` on \*nix and macOS, and
By setting this environmental value, you can set a path to a certificate bundle
file to be used during SSL/TLS peer verification.
### COMPOSER_DISABLE_XDEBUG_WARN
If set to 1, this env suppresses a warning when Composer is running with the Xdebug extension enabled.
### COMPOSER_DISCARD_CHANGES
This env var controls the [`discard-changes`](06-config.md#discard-changes) config option.

@ -260,7 +260,7 @@ driver directly, Composer will still attempt to use GitHub's zip files.
Defaults to `true`. Composer allows repositories to define a notification URL,
so that they get notified whenever a package from that repository is installed.
This option allows you to disable that behaviour.
This option allows you to disable that behavior.
## discard-changes

@ -156,10 +156,10 @@ This issue can also happen on cPanel instances, when the shell fork bomb protect
## Xdebug impact on Composer
To improve performance when the xdebug extension is enabled, Composer automatically restarts PHP without it.
To improve performance when the Xdebug extension is enabled, Composer automatically restarts PHP without it.
You can override this behavior by using an environment variable: `COMPOSER_ALLOW_XDEBUG=1`.
Composer will always show a warning if xdebug is being used, but you can override this with an environment variable:
Composer will always show a warning if Xdebug is being used, but you can override this with an environment variable:
`COMPOSER_DISABLE_XDEBUG_WARN=1`. If you see this warning unexpectedly, then the restart process has failed:
please report this [issue](https://github.com/composer/composer/issues).

@ -205,7 +205,7 @@ class Application extends BaseApplication
}
if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
$io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
$io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
}
if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {

@ -28,6 +28,11 @@ class ArrayRepository extends BaseRepository
{
/** @var PackageInterface[] */
protected $packages;
/**
* @var PackageInterface[] indexed by package unique name and used to cache hasPackage calls
*/
protected $packageMap;
public function __construct(array $packages = array())
{
@ -121,15 +126,14 @@ class ArrayRepository extends BaseRepository
*/
public function hasPackage(PackageInterface $package)
{
$packageId = $package->getUniqueName();
foreach ($this->getPackages() as $repoPackage) {
if ($packageId === $repoPackage->getUniqueName()) {
return true;
if ($this->packageMap === null) {
$this->packageMap = array();
foreach ($this->getPackages() as $repoPackage) {
$this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
}
}
return false;
return isset($this->packageMap[$package->getUniqueName()]);
}
/**
@ -151,6 +155,9 @@ class ArrayRepository extends BaseRepository
$this->addPackage($aliasedPackage);
}
}
// invalidate package map cache
$this->packageMap = null;
}
protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
@ -171,6 +178,9 @@ class ArrayRepository extends BaseRepository
if ($packageId === $repoPackage->getUniqueName()) {
array_splice($this->packages, $key, 1);
// invalidate package map cache
$this->packageMap = null;
return;
}
}

@ -125,7 +125,7 @@ class PlatformRepository extends ArrayRepository
$this->addExtension($name, $prettyVersion);
}
// Check for xdebug in a restarted process
// Check for Xdebug in a restarted process
if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
$this->addExtension('xdebug', $prettyVersion);
}

@ -143,7 +143,7 @@ class GitDriver extends VcsDriver
public function getChangeDate($identifier)
{
$this->process->execute(sprintf(
'git log -1 --format=%%at %s',
'git -c log.showSignature=false log -1 --format=%%at %s',
ProcessExecutor::escape($identifier)
), $output, $this->repoDir);

@ -85,7 +85,9 @@ class Git
}
// failed to checkout, first check git accessibility
$this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
$this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
}
}
// if we have a private github url and the ssh protocol is disabled then we skip it and directly fallback to https
@ -97,7 +99,7 @@ class Git
if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
// private github repository without ssh key access, try https with auth
if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
|| preg_match('{^(https?)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
|| preg_match('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
) {
if (!$this->io->hasAuthentication($match[1])) {
$gitHubUtil = new GitHub($this->io, $this->config, $this->process);

@ -155,7 +155,7 @@ class ProcessExecutor
//@see https://bugs.php.net/bug.php?id=43784
//@see https://bugs.php.net/bug.php?id=49446
if ('\\' === DIRECTORY_SEPARATOR) {
if ('' === $argument) {
if ((string) $argument === '') {
return escapeshellarg($argument);
}

@ -62,7 +62,7 @@ class ApplicationTest extends TestCase
$outputMock->expects($this->at($index++))
->method("write")
->with($this->equalTo('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>'));
->with($this->equalTo('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>'));
}
$outputMock->expects($this->at($index++))

@ -735,7 +735,7 @@ composer https://github.com/old/url (push)
$cmd = str_replace('cd ', 'cd /D ', $cmd);
$cmd = str_replace('composerPath', getcwd().'/composerPath', $cmd);
return str_replace('""', '', strtr($cmd, "'", '"'));
return strtr($cmd, "'", '"');
}
return $cmd;

@ -0,0 +1,145 @@
<?php
namespace Composer\Test\Util;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use Composer\Util\Git;
use Composer\Util\ProcessExecutor;
use PHPUnit\Framework\TestCase;
class GitTest extends TestCase
{
/** @var Git */
private $git;
/** @var IOInterface&\PHPUnit_Framework_MockObject_MockObject */
private $io;
/** @var Config&\PHPUnit_Framework_MockObject_MockObject */
private $config;
/** @var ProcessExecutor&\PHPUnit_Framework_MockObject_MockObject */
private $process;
/** @var Filesystem&\PHPUnit_Framework_MockObject_MockObject */
private $fs;
protected function setUp()
{
$this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$this->config = $this->getMockBuilder('Composer\Config')->disableOriginalConstructor()->getMock();
$this->process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->disableOriginalConstructor()->getMock();
$this->fs = $this->getMockBuilder('Composer\Util\Filesystem')->disableOriginalConstructor()->getMock();
$this->git = new Git($this->io, $this->config, $this->process, $this->fs);
}
/**
* @dataProvider publicGithubNoCredentialsProvider
*/
public function testRunCommandPublicGitHubRepositoryNotInitialClone($protocol, $expectedUrl)
{
$that = $this;
$commandCallable = function ($url) use ($that, $expectedUrl) {
$that->assertSame($expectedUrl, $url);
return 'git command';
};
$this->mockConfig($protocol);
$this->process
->expects($this->once())
->method('execute')
->with($this->equalTo('git command'))
->willReturn(0);
$this->git->runCommand($commandCallable, 'https://github.com/acme/repo', null, true);
}
public function publicGithubNoCredentialsProvider()
{
return array(
array('ssh', 'git@github.com:acme/repo'),
array('https', 'https://github.com/acme/repo'),
);
}
/**
* @expectedException \RuntimeException
*/
public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithoutAuthentication()
{
$that = $this;
$commandCallable = function ($url) use ($that) {
$that->assertSame('https://github.com/acme/repo', $url);
return 'git command';
};
$this->mockConfig('https');
$this->process
->method('execute')
->willReturnMap(array(
array('git command', null, null, 1),
array('git --version', null, null, 0),
));
$this->git->runCommand($commandCallable, 'https://github.com/acme/repo', null, true);
}
/**
* @dataProvider privateGithubWithCredentialsProvider
*/
public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication($gitUrl, $protocol, $gitHubToken, $expectedUrl)
{
$commandCallable = function ($url) use ($expectedUrl) {
if ($url !== $expectedUrl) {
return 'git command failing';
}
return 'git command ok';
};
$this->mockConfig($protocol);
$this->process
->method('execute')
->willReturnMap(array(
array('git command failing', null, null, 1),
array('git command ok', null, null, 0),
));
$this->io
->method('isInteractive')
->willReturn(false);
$this->io
->method('hasAuthentication')
->with($this->equalTo('github.com'))
->willReturn(true);
$this->io
->method('getAuthentication')
->with($this->equalTo('github.com'))
->willReturn(array('username' => 'token', 'password' => $gitHubToken));
$this->git->runCommand($commandCallable, $gitUrl, null, true);
}
public function privateGithubWithCredentialsProvider()
{
return array(
array('git@github.com:acme/repo.git', 'ssh', 'MY_GITHUB_TOKEN', 'https://token:MY_GITHUB_TOKEN@github.com/acme/repo.git'),
array('https://github.com/acme/repo', 'https', 'MY_GITHUB_TOKEN', 'https://token:MY_GITHUB_TOKEN@github.com/acme/repo.git'),
);
}
private function mockConfig($protocol)
{
$this->config
->method('get')
->willReturnMap(array(
array('github-domains', 0, array('github.com')),
array('github-protocols', 0, array($protocol)),
));
}
}
Loading…
Cancel
Save