Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during composer update: In Problem.php line 143: [ArgumentCountError] 4 arguments are required, 3 given #11359

Closed
Synchro opened this issue Mar 2, 2023 · 3 comments
Milestone

Comments

@Synchro
Copy link

Synchro commented Mar 2, 2023

I'm running composer 2.5.4 on PHP 8.2.3. Composer crashes at the end of composer update with this error.

My composer.json:

{
    "name": "myapp/myapp",
    "description": "Myapp API",
    "license": "proprietary",
    "type": "project",
    "keywords": [
        "reusable",
        "food containers",
        "drinks",
        "environment"
    ],
    "authors": [
        {
            "name": "Marcus Bointon",
            "email": "marcus@example.com",
            "role": "Developer"
        }
    ],
    "homepage": "https://www.example.com/",
    "require": {
        "php": "^8.2",
        "ext-imagick": "*",
        "ext-intl": "*",
        "ext-json": "*",
        "ext-mbstring": "*",
        "ext-mysqlnd": "*",
        "ext-openssl": "*",
        "ext-pdo": "*",
        "ext-sodium": "*",
        "alt-three/segment": "dev-laravel-10",
        "bacon/bacon-qr-code": "^2.0.8",
        "barryvdh/laravel-dompdf": "^2.0.1",
        "braintree/braintree_php": "^6.11.1",
        "camroncade/timezone": "^0.2.0",
        "cmixin/business-day": "^1.16.1",
        "datomatic/nova-enum-field": "^1.6.1",
        "devtical/nova-qrcode-field": "^2.0.1",
        "doctrine/dbal": "^2.13.9",
        "drewm/mailchimp-api": "^2.5.4",
        "dyrynda/laravel-model-uuid": "^7.0",
        "guzzlehttp/guzzle": "^7.5",
        "honeybadger-io/honeybadger-laravel": "^3.15.0",
        "hubspot/api-client": "^8.4.1",
        "idez/nova-date-range-filter": "^2.1",
        "inertiajs/inertia-laravel": "^0.6.9",
        "jenssegers/agent": "^2.6.4",
        "juststeveking/gtin-php": "^1.0.1",
        "laravel-notification-channels/fcm": "^3.0",
        "laravel/framework": "^10.1.5",
        "laravel/horizon": "^5.14.2",
        "laravel/nova": "^4.22.1",
        "laravel/passport": "^11.8.2",
        "laravel/socialite": "^5.6.1",
        "laravel/telescope": "^4.14.0",
        "laravel/tinker": "^2.8.1",
        "laravel/ui": "^4.2.1",
        "league/iso3166": "^3.0.0",
        "league/oauth2-client": "^2.6.1",
        "lorisleiva/laravel-actions": "^2.5.1",
        "maatwebsite/laravel-nova-excel": "^1.3.2",
        "matanyadaev/laravel-eloquent-spatial": "^3.1.1",
        "mostafaznv/nova-map-field": "^3.0",
        "outl1ne/nova-multiselect-filter": "^4.0.7",
        "outl1ne/nova-translations-loader": "^5.0.1",
        "psr/simple-cache": "^3.0",
        "silber/bouncer": "^1.0.1",
        "socialiteproviders/apple": "^5.3.1",
        "spatie/laravel-enum": "^3.0.2",
        "spatie/laravel-failed-job-monitor": "^4.2.1",
        "spatie/laravel-ignition": "^2.0",
        "spatie/laravel-json-api-paginate": "^1.12.2",
        "spatie/laravel-query-builder": "^5.2.0",
        "spatie/laravel-validation-rules": "^3.2.2",
        "stechstudio/laravel-hubspot": "^0.3",
        "symfony/intl": "^6.2.5",
        "tapp/laravel-airtable": "^2.0",
        "warmans/date-range": "^0.0.3",
        "yadahan/nova-bouncer": "^2.0.1"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.8.1",
        "barryvdh/laravel-ide-helper": "^2.13.0",
        "beyondcode/laravel-dump-server": "^1.9",
        "ergebnis/composer-normalize": "^2.30.2",
        "fakerphp/faker": "^1.21",
        "laravel/forge-cli": "^1.7.0",
        "laravel/sail": "^1.21.0",
        "mockery/mockery": "^1.5.1",
        "nunomaduro/collision": "^7.0.5",
        "nunomaduro/larastan": "^2.4.1",
        "php-parallel-lint/php-parallel-lint": "dev-master",
        "phpro/grumphp-shim": "^1.15",
        "phpunit/phpunit": "^10.0.13",
        "rector/rector": "^0.14.8",
        "roave/security-advisories": "dev-latest",
        "spatie/test-time": "^1.3.2",
        "squizlabs/php_codesniffer": "^3.7.2",
        "thibautselingue/local-php-security-checker-installer": "^1.0.4",
        "vimeo/psalm": "^5.7.7"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://nova.laravel.com"
        },
        {
            "type": "vcs",
            "url": "https://github.com/Synchro/Segment"
        }
    ],
    "minimum-stability": "dev",
    "prefer-stable": true,
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/",
            "tests/TestCase.php",
            "tests/CreatesApplication.php"
        ]
    },
    "config": {
        "allow-plugins": {
            "composer/package-versions-deprecated": true,
            "phpro/grumphp-shim": true,
            "ergebnis/composer-normalize": true
        },
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": [
                "laravel/passport"
            ]
        }
    },
    "scripts": {
        "post-update-cmd": [
            "@php artisan nova:publish",
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "cf": [
            "./vendor/bin/phpcbf"
        ],
        "cs": [
            "./vendor/bin/phpcs"
        ],
        "test": [
            "./vendor/bin/phpunit"
        ]
    }
}

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK git version 2.39.2
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.5.4
PHP version: 8.2.3
PHP binary path: /opt/homebrew/Cellar/php/8.2.3/bin/php
OpenSSL version: OpenSSL 1.1.1t  7 Feb 2023
cURL version: 7.88.1 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1t
zip: extension present, unzip present, 7-Zip not available

When I run this command:

composer update -vvv

I get the following output:

Running 2.5.4 (2023-02-15 13:10:06) with PHP 8.2.3 on Darwin / 22.3.0
Reading ./composer.json (/Users/marcus/Sites/myapp/composer.json)
Loading config file /Users/marcus/.composer/config.json
Loading config file /Users/marcus/.composer/auth.json
Loading config file ./composer.json (/Users/marcus/Sites/myapp/composer.json)
Loading config file /Users/marcus/Sites/myapp/auth.json
Reading /Users/marcus/Sites/myapp/auth.json
Checked CA file /opt/homebrew/etc/ca-certificates/cert.pem: valid
Executing command (/Users/marcus/Sites/myapp): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing async command (/Users/marcus/Sites/myapp): git rev-list main..L10
Executing async command (/Users/marcus/Sites/myapp): git rev-list develop..L10
Executing async command (/Users/marcus/Sites/myapp): git rev-list remotes/origin/main..L10
Executing async command (/Users/marcus/Sites/myapp): git rev-list remotes/origin/develop..L10
Reading /Users/marcus/.composer/composer.json
Loading config file /Users/marcus/.composer/config.json
Loading config file /Users/marcus/.composer/auth.json
Loading config file /Users/marcus/.composer/composer.json (/Users/marcus/.composer/composer.json)
Loading config file /Users/marcus/.composer/auth.json
Reading /Users/marcus/.composer/auth.json
Reading /Users/marcus/Sites/myapp/vendor/composer/installed.json
Reading /Users/marcus/.composer/vendor/composer/installed.json
Loading plugin PackageVersions\Installer (from composer/package-versions-deprecated)
Loading plugin Ergebnis\Composer\Normalize\NormalizePlugin (from ergebnis/composer-normalize)
Loading plugin GrumPHP\Composer\GrumPHPPlugin (from phpro/grumphp-shim)
Reading ./composer.lock (/Users/marcus/Sites/myapp/composer.lock)
Loading composer repositories with package information
Reading /Users/marcus/Library/Caches/composer/repo/https---nova.laravel.com/packages.json from cache
Using HTTP basic authentication with username "tech@example.com"
Downloading https://nova.laravel.com/packages.json if modified
[304] https://nova.laravel.com/packages.json
Reading /Users/marcus/Library/Caches/composer/repo/https---nova.laravel.com/provider-laravel~nova.json from cache
[lots of downloading, reading, 304 lines skipped]
Built pool.
Running pool optimizer.
Pool optimizer completed in 0.969 seconds
Found 17,453 package versions referenced in your dependency graph. 15,839 (91%) were optimized away.
Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.
Something's changed, looking at all rules again (pass #2)
Dependency resolution completed in 0.009 seconds
[...]

In Problem.php line 143:
                                     
  [ArgumentCountError]               
  4 arguments are required, 3 given  
                                     

Exception trace:
  at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/DependencyResolver/Problem.php:143
 sprintf() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/DependencyResolver/Problem.php:143
 Composer\DependencyResolver\Problem::formatDeduplicatedRules() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/DependencyResolver/Problem.php:100
 Composer\DependencyResolver\Problem->getPrettyString() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/DependencyResolver/SolverProblemsException.php:52
 Composer\DependencyResolver\SolverProblemsException->getPrettyString() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/Installer.php:480
 Composer\Installer->doUpdate() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/Installer.php:287
 Composer\Installer->run() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/Command/UpdateCommand.php:247
 Composer\Command\UpdateCommand->execute() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/Console/Application.php:377
 Composer\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/src/Composer/Console/Application.php:141
 Composer\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.5.4/bin/composer/bin/composer:88
 require() at /opt/homebrew/Cellar/composer/2.5.4/bin/composer:29

update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>...]

And I expected this to happen:

It not to crash.

@Synchro
Copy link
Author

Synchro commented Mar 7, 2023

That line contains:

$result[] = sprintf($message, $package, ' '.reset($versions));

The docs say that 3 args is ok, so I guess it may be because the format string refers to more than two params, and only two are given.

I can't seem to add a var_dump() in here to see what the values are because as soon as I edit the phar, it throws this error:

Fatal error: Uncaught PharException: manifest cannot be larger than 100 MB in phar "/opt/homebrew/Cellar/composer/2.5.4/bin/composer" in /opt/homebrew/Cellar/composer/2.5.4/bin/composer:28
Stack trace:
#0 /opt/homebrew/Cellar/composer/2.5.4/bin/composer(28): Phar::mapPhar('composer.phar')
#1 {main}
  thrown in /opt/homebrew/Cellar/composer/2.5.4/bin/composer on line 28

@Seldaek
Copy link
Member

Seldaek commented Mar 15, 2023

Ah well, that's an unlucky case of something used a percent sign in a branch name AND it caused a resolution conflict..

Anyway should be fixed by b8f82b2 but here is the result with the fix in case it helps you:

  Problem 1
    - Root composer.json requires alt-three/segment dev-laravel-10 -> satisfiable by alt-three/segment[dev-laravel-10].
    - alt-three/segment dev-laravel-10 requires segmentio/analytics-php dev-Issue-%23210-testing -> found segmentio/analytics-php[dev-update_set_context_method, ..., dev-proxy_configuration, 0.2.2, ..., 0.4.8, 1.0.0, ..., 1.x-dev, 2.0.0, 3.5.0] but it does not match the constraint.

@Seldaek Seldaek closed this as completed Mar 15, 2023
@Synchro
Copy link
Author

Synchro commented Mar 15, 2023

Thanks Jordi, I'll be your edge case! The upstream package concerned is about to release an updated version anyway, so I won't have to use my patched repo any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants