1
0
Fork 0

Fix defaultRepos fallback does not use auth config

When a full 'composer' cannot be constructed (because there is no
local composer.json and no global composer.json), some commands
(e.g. `show -a`) fall back to the default repositories from the
`$COMPOSER_HOME/config.json` file. Without this fix, any auth
configuration from `$COMPOSER_HOME/auth.json` is not used for
these repositories in such a fallback scenario.

Steps to reproduce:

* Configure a password-protected composer repository in
  `$COMPOSER_HOME/config.json`.
* Configure valid credentials for that repository in
  `$COMPOSER_HOME/auth.json`.
* Make sure there is no file `$COMPOSER_HOME/composer.json`.
* Ensure the current working directory has no `composer.json`.
* Run `composer show -a some/package`.

Expected: Information about `some/package` is shown without
needing to enter credentials.

Actual: A prompt "Authentication required" is shown for the
private repository. When running the same command in a dir
that has a `composer.json`, or when `$COMPOSER_HOME/composer.json`
exists, things work as expected.
pull/7937/head
Arnout Boks 2019-01-30 14:18:06 +01:00
parent b3182b0f7d
commit d1ce9f6246
1 changed files with 1 additions and 0 deletions

View File

@ -93,6 +93,7 @@ class RepositoryFactory
{ {
if (!$config) { if (!$config) {
$config = Factory::createConfig($io); $config = Factory::createConfig($io);
$io->loadConfiguration($config);
} }
if (!$rm) { if (!$rm) {
if (!$io) { if (!$io) {