Repository: composer/satis

Issue #529: Unable to resolve virtual package with providers = true options
Created: 2019-03-05T11:19:47Z
Composer is unable to resolve packages mirrored by generated Satis repository.
Installation works as expected without satis-repository in composer.json or if repository is built without "providers": true option.
Reproduction steps:
run satis build with satis.json:
{
    "name": "Repository",
    "homepage": "http://localhost:4170",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        }
    ],
    "require": {
        "fig/http-message-util": "1.1.3",
        "psr/container": "1.0.0",
        "psr/http-factory": "1.0.0",
        "psr/http-message": "1.0.1",
        "psr/http-server-handler": "1.0.1",
        "psr/http-server-middleware": "1.0.1",
        "zendframework/zend-diactoros": "2.1.1",
        "zendframework/zend-escaper": "2.6.0",
        "zendframework/zend-expressive": "3.2.1",
        "zendframework/zend-expressive-router": "3.1.0",
        "zendframework/zend-expressive-template": "2.0.0",
        "zendframework/zend-httphandlerrunner": "1.1.0",
        "zendframework/zend-stratigility": "3.1.0"
    },
    "providers": true,
    "output-dir": "./packages",
    "archive": {
        "directory": "dist",
        "format": "zip",
        "prefix-url": "http://localhost:4170",
        "skip-dev": true
    }
}
Create empty folder with composer.json:
{
    "name": "example/template",
    "description": "Package description",
    "type": "project",
    "license": "MIT",
    "repositories": [
        {
            "type": "composer",
            "url": "http://localhost:4170/"
        }, {
            "packagist": false
        }
    ],
    "require": {
        "zendframework/zend-diactoros": "^2.0",
        "zendframework/zend-expressive": "^3.2"
    },
    "config": {
        "secure-http": false,
        "sort-packages": true,
        "preferred-install": {
            "*": "dist"
        }
    }
}
Run composer update -vvv.
Output:
Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\Users\Username\AppData\Local\Temp\ope25BA.tmp: valid
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git branch --no-color --no-abbrev -v
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git describe --exact-match --tags
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git log --pretty="%H" -n1 HEAD
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): hg branch
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): fossil branch list
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): fossil tag list
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): svn info --xml
Failed to initialize global composer: Composer could not find the config file: C:/Users/Username/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.8.4 (2019-02-11 10:52:10) with PHP 7.3.2 on Windows NT / 10.0
Loading composer repositories with package information
Downloading http://localhost:4170/packages.json
Warning: Accessing localhost over http which is an insecure protocol.
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/packages.json into cache
Updating dependencies (including require-dev)
Downloading http://localhost:4170/p/zendframework/zend-diactoros%24980144f5ac6179b95be0c0d4f131ff6d16f32e44b003f71c5f4ffc3c3a08d2fa.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-diactoros.json into cache
Downloading http://localhost:4170/p/psr/http-factory%24be6ea9dd41ac07068c080bea7d7168bc3bdf1ac618ff8d2c338765d3bf70f8e3.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-factory.json into cache
Downloading http://localhost:4170/p/psr/http-message%242e8eba2185113b23985e96e7aec692e054f3f426b81d01684f3867408fee5a36.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-message.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive%243769d281a8dc8560e5fbf7a1dfd3bdd01d75617b7c4a7bc3108b2b0205955e20.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive.json into cache
Downloading http://localhost:4170/p/fig/http-message-util%2423fc9131b8a1c11fd90985fb19c0d4501ba43b5083cb38cc59389ef1cfebefcc.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-fig$http-message-util.json into cache
Downloading http://localhost:4170/p/psr/container%24777c77a8ba52ffbbafa2061af6a3dfb398efcc62360ad360d6dd991f35d9b630.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$container.json into cache
Downloading http://localhost:4170/p/psr/http-server-middleware%244fd8218c74dc8cdef426b7791d05e06bdb9638e7c18713c2ad36c6f958771900.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-server-middleware.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive-router%24e0ee02cf76d00edfeede259b944cbac4b914ebe23f1e8bae32a6f395c2458052.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive-router.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive-template%242ec817460c71c46051bd0adb16970909223aaf235b01342cd538216cab8e96de.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive-template.json into cache
Downloading http://localhost:4170/p/zendframework/zend-httphandlerrunner%24cf8ee39542dd7c4813bf460ebee1c2ebebda736b972a08bf18ca4fc945d59647.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-httphandlerrunner.json into cache
Downloading http://localhost:4170/p/zendframework/zend-stratigility%24f46b3ae6377f37a6a70a38701cdf990a99856845951517d9e86fdac7e0573c01.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-stratigility.json into cache
Downloading http://localhost:4170/p/psr/http-server-handler%24f73d6452ec6d02f86534fcad2fc51b3baf390bf107ddd277430ff344180ce041.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-server-handler.json into cache
Downloading http://localhost:4170/p/zendframework/zend-escaper%241e7ade65f12923e6e64f14af11f3aa299a6692677fd0ced6aae101f5c38925ad.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-escaper.json into cache
Resolving dependencies through SAT

Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - zendframework/zend-httphandlerrunner 1.1.0 requires psr/http-message-implementation ^1.0 -> no matching package found.
    - zendframework/zend-expressive 3.2.1 requires zendframework/zend-httphandlerrunner ^1.0.1 -> satisfiable by zendframework/zend-httphandlerrunner[1.1.0].
    - Installation request for zendframework/zend-expressive ^3.2 -> satisfiable by zendframework/zend-expressive[3.2.1].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Duplicate issue #534: Enabling "providers" breaks "replace" for packages from other repositories
Created: 2019-03-27T10:14:16Z
Related to #367 (#371 has only fixed replacing within the same repository).
Repro steps


create satis.json
{
    "name": "acme/satis",
    "homepage": "http://localhost:8080/",
    "require-all": true,
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "acme/phpunit",
                "version": "7.5.8.0",
                "dist": {
                    "type": "file",
                    "url": "https://phar.phpunit.de/phpunit-7.5.8.phar"
                },
                "replace": {
                    "phpunit/phpunit": "self.version"
                }
            }
        }
    ]
}


run satis build


create a test project with the following composer.json
{
    "name": "acme/project",
    "repositories": [
        {"type":  "composer", "url": "http://localhost:8080/"}
    ],
    "require": {
        "kuria/phpunit-extras": "^2.0.3",
        "acme/phpunit": "^7.5"
    },
    "config": {
        "secure-http": false
    }
}


run composer update
This works as expected. The acme/phpunit package is pulled instead of phpunit/phpunit, which is a dependency of kuria/phpunit-extras.
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing kuria/iterable (v1.0.0): Downloading (100%)
  - Installing acme/phpunit (7.5.8.0): Downloading (100%)
  - Installing kuria/phpunit-extras (v2.0.3): Downloading (100%)
Writing lock file
Generating autoload files



add "providers": true to satis.json


build satis again


delete composer.lock and vendor in the test project


run composer update
This fails with the following:
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for kuria/phpunit-extras ^2.0.3 -> satisfiable by kuria/phpunit-extras[v2.0.3].
    - kuria/phpunit-extras v2.0.3 requires phpunit/phpunit ^7.3.5 -> satisfiable by phpunit/phpunit[7.3.5, 7.4.0, 7.4.1, 7.4.2, 7.4.3, 7.4.4, 7.4.5, 7.5.0, 7.5.1, 7.5.2, 7.5.3, 7.5.4, 7.5.5, 7.5.6, 7.5.7, 7.5.8].
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.3.5
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.0
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.1
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.2
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.3
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.4
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.4.5
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.0
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.1
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.2
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.3
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.4
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.5
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.6
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.7
    - don't install acme/phpunit 7.5.8.0|don't install phpunit/phpunit 7.5.8
    - Installation request for acme/phpunit ^7.5 -> satisfiable by acme/phpunit[7.5.8.0]

Closing comment (2020-02-10T13:04:16Z): Possibly related to #529 ?