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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled LogicException "You must use the ProcessExecutor instance..." from status command #10703

Closed
uuf6429 opened this issue Apr 4, 2022 · 1 comment
Labels
Milestone

Comments

@uuf6429
Copy link

@uuf6429 uuf6429 commented Apr 4, 2022

My composer.json (old project, don't ask 馃槄):

{
    "require": {
        "php": "^7.2",
        "ext-curl": "*",
        "ext-ftp": "*",
        "ext-json": "*",
        "ext-openssl": "*",
        "ext-pdo": "*",
        "aws/aws-sdk-php": "^3.90",
        "guzzlehttp/guzzle": "^6.3",
        "monolog/monolog": "^1.24",
        "catfan/medoo": "^1.6",
        "elasticsearch/elasticsearch": "^6.1",
        "ready2order/user-agent-parser": "^2.1",
        "whichbrowser/parser": "^2.0",
        "phpmailer/phpmailer": "^6.0",
        "google/apiclient": "^2.0",
        "googleads/googleads-php-lib": "^47.0",
        "chargebee/chargebee-php": "^3",
        "maknz/slack": "^1.7"
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK
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.3.3
PHP version: 7.3.33
PHP binary path: /usr/local/Cellar/php@7.3/7.3.33_2/bin/php
OpenSSL version: OpenSSL 1.1.1m  14 Dec 2021
cURL version: 7.82.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1n
zip: extension present, unzip present, 7-Zip present (7z)

When I run this command (also after running composer self-update --snapshot):

composer status -vvv

I get the following output:

Running 2.3.3 (2022-04-01 22:15:35) with PHP 7.3.33 on Darwin / 21.4.0
Reading ./composer.json (/Users/<user>/Projects/<project>/composer.json)
Loading config file /Users/<user>/.composer/auth.json
Loading config file ./composer.json (/Users/<user>/Projects/<project>/composer.json)
Checked CA file /usr/local/etc/ca-certificates/cert.pem: valid
Executing command (/Users/<user>/Projects/<project>): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Reading /Users/<user>/.composer/composer.json
Loading config file /Users/<user>/.composer/auth.json
Loading config file /Users/<user>/.composer/composer.json (/Users/<user>/.composer/composer.json)
Loading config file /Users/<user>/.composer/auth.json
Reading /Users/<user>/.composer/auth.json
Reading /Users/<user>/Projects/<project>/vendor/composer/installed.json
Reading /Users/<user>/.composer/vendor/composer/installed.json
Loading plugin PackageVersions\Installer (from composer/package-versions-deprecated, installed globally)
Executing command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): git status --porcelain --untracked-files=no
Executing command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing async command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): git rev-list master..2703896142f292058ce9d6c9026a9329a89778e0
Executing async command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): git rev-list remotes/origin/master..2703896142f292058ce9d6c9026a9329a89778e0
Executing async command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): git rev-list remotes/origin/2.8..2703896142f292058ce9d6c9026a9329a89778e0
Executing command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): git describe --exact-match --tags
Executing command (/Users/<user>/Projects/<project>/vendor/aws/aws-sdk-php): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'

In ProcessExecutor.php line 149:
                                                                                                                         
  [LogicException]                                                                                                       
  You must use the ProcessExecutor instance which is part of a Composer\Loop instance to be able to run async processes  
                                                                                                                         

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php:149
 Composer\Util\ProcessExecutor->executeAsync() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:324
 Composer\Package\Version\VersionGuesser->guessFeatureVersion() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:181
 Composer\Package\Version\VersionGuesser->guessGitVersion() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:77
 Composer\Package\Version\VersionGuesser->guessVersion() at phar:///usr/local/bin/composer/src/Composer/Command/StatusCommand.php:130
 Composer\Command\StatusCommand->doExecute() at phar:///usr/local/bin/composer/src/Composer/Command/StatusCommand.php:72
 Composer\Command\StatusCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:83
 require() at /usr/local/bin/composer:29

status [-v|vv|vvv|--verbose]

And I expected this to happen:

The usual status output.

@sabbaman
Copy link

@sabbaman sabbaman commented Apr 6, 2022

Same error on composer status, but with php 8.1

`composer diagnose

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
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.3.3
PHP version: 8.1.3
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
cURL version: 7.64.0 libz 1.2.11 ssl OpenSSL/1.1.1d
zip: extension present, unzip present, 7-Zip not available
`
I dug a bit into the code, I think the problem is that here in the doExecute method of StatusCommand.php the VersionGuesser is initialized from scratch, instead of using the instance initialized here in the Factory.php (which should be ready for async execution).

I'm sorry I'm not familiar enough with the composer codebase to attempt a pull request...

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

No branches or pull requests

3 participants