composer: Composer 2.0.10 fails with fatal error on every command (Uncaught TypeError: Argument 3 passed to ...)

I updated to composer 2.0.10 this morning. After that I cannot run any composer command in my project anymore. Every commands fails with the error below.

Once I remove the composer.lock file and the vendor dir, I can run composer install again without error. After that, every command fails again. It seems like something is broken somewhere in the vendor dir.

Feel free to ask for more information, if you need more.

When I do a roll-back to 2.0.9 everything works fine again.

My composer.json:

{
    "name": "shopware/development",
    "type": "project",
    "description": "A Shopware 6 skeleton to run integration tests.",
    "license": "MIT",
    "require": {
        "php": ">=7.2",
        "composer/package-versions-deprecated": "^1.8.0",
        "pickware/shopware-integration-test-plugin": "*",
        "shopware/platform": "6.3.1.*"
    },
    "require-dev": {
        "ext-tokenizer": "*",
        "ext-xmlwriter": "*",
        "bheller/images-generator": "^1.0.1",
        "fzaninotto/faker": "^1.8.0",
        "johnkary/phpunit-speedtrap": "^3.1.0",
        "league/flysystem-memory": "^1.0.2",
        "mbezhanov/faker-provider-collection": "^1.2.1",
        "phpunit/phpunit": "^8.4.0",
        "smalot/pdfparser": "^0.14.0",
        "symfony/browser-kit": "^4.4.4",
        "symfony/dependency-injection": "^4.4.4",
        "symfony/phpunit-bridge": "^4.4.4",
        "symfony/stopwatch": "^4.4.4",
        "symfony/var-dumper": "^4.4.4",
        "symfony/web-profiler-bundle": "^4.4.4"
    },
    "config": {
        "optimize-autoloader": true
    },
    "autoload": {
        "psr-4": {
            "Shopware\\Development\\": "src/"
        }
    },
    "repositories": [
        {
            "type": "path",
            "url": "../../plugins/*",
            "options": {
                "symlink": true
            }
        },
        {
            "type": "path",
            "url": "../../plugins-dev/*",
            "options": {
                "symlink": true
            }
        },
        {
            "type": "path",
            "url": "../../libraries/composer-packages/*",
            "options": {
                "symlink": true
            }
        },
        {
            "type": "path",
            "url": "../../bundles/*",
            "options": {
                "symlink": true
            }
        }
    ],
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-install-cmd": [
            "@remove-lock-file"
        ],
        "post-update-cmd": [
            "@remove-lock-file"
        ],
        "remove-lock-file": [
            "# Workaround as long as ocramius/package-versions is incompatible with composer config `lock: false`",
            "rm composer.lock"
        ]
    }
}

Output of composer diagnose:

The command fails

When I run this command:

composer -vvv

I get the following output:

Reading ./composer.json (/Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/composer.json)
Loading config file /Users/manuelkress/.composer/config.json
Loading config file /Users/manuelkress/.composer/auth.json
Loading config file ./composer.json (/Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/composer.json)
Checked CA file /usr/local/etc/openssl@1.1/cert.pem: valid
Executing command (/Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test): git branch -a --no-color --no-abbrev -v
Reading /Users/manuelkress/.composer/composer.json
Loading config file /Users/manuelkress/.composer/config.json
Loading config file /Users/manuelkress/.composer/auth.json
Loading config file /Users/manuelkress/.composer/composer.json (/Users/manuelkress/.composer/composer.json)
Loading config file /Users/manuelkress/.composer/auth.json
Reading /Users/manuelkress/.composer/auth.json
Reading /Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/vendor/composer/installed.json
Reading /Users/manuelkress/.composer/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Loading plugin Pickware\ShopwarePlugins\DependencyLoader\DependencyLoaderComposerPlugin
Loading plugin PackageVersions\Installer_composer_tmp0 (installed globally)
Loading plugin Ergebnis\Composer\Normalize\NormalizePlugin (installed globally)
PHP Fatal error:  Uncaught TypeError: Argument 3 passed to Composer\Package\Locker::__construct() must be an instance of Composer\Repository\RepositoryManager, instance of Composer\Installer\InstallationManager given, called in phar:///usr/local/bin/composer/src/Composer/Factory.php on line 411 and defined in /Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/vendor/composer/composer/src/Composer/Package/Locker.php:54
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Factory.php(411): Composer\Package\Locker->__construct(Object(Composer\IO\ConsoleIO), Object(Composer\Json\JsonFile), Object(Composer\Installer\InstallationManager), '{\n    "name": "...', Object(Composer\Util\ProcessExecutor))
#1 phar:///usr/local/bin/composer/src/Composer/Factory.php(595): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#2 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(409): Composer\Factory::create(Object(Composer\IO\ConsoleIO), in /Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/vendor/composer/composer/src/Composer/Package/Locker.php on line 54

Fatal error: Uncaught TypeError: Argument 3 passed to Composer\Package\Locker::__construct() must be an instance of Composer\Repository\RepositoryManager, instance of Composer\Installer\InstallationManager given, called in phar:///usr/local/bin/composer/src/Composer/Factory.php on line 411 and defined in /Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/vendor/composer/composer/src/Composer/Package/Locker.php:54
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Factory.php(411): Composer\Package\Locker->__construct(Object(Composer\IO\ConsoleIO), Object(Composer\Json\JsonFile), Object(Composer\Installer\InstallationManager), '{\n    "name": "...', Object(Composer\Util\ProcessExecutor))
#1 phar:///usr/local/bin/composer/src/Composer/Factory.php(595): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#2 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(409): Composer\Factory::create(Object(Composer\IO\ConsoleIO), in /Users/manuelkress/Pickware/ShopwareNext/Plugins/shopware-plugins/shopware-projects/plugin-integration-test/vendor/composer/composer/src/Composer/Package/Locker.php on line 54

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Ok Composer 2.0.11 is out and should fix this regression, sorry for the trouble.

@stof we can’t simply exclude composer/composer, https://github.com/composer-unused/composer-unused/issues/159 shows this can cause issues with any of Composer’s dependencies, so I rolled back the whole autoloader-prepending change.

Feels like we have the same issue in other projects as well https://github.com/composer/composer/issues/9717