studio
studio copied to clipboard
Fix LogicException for composer ^2.3
Fixes #115
Hmm... could we just recommend/require Composer >2.3.4 when on 2.3.x? That seems to be the release with the fix.
Unforntunatly it isn't fixed in 2.3.4. That release fixed internal issues with the same exception. The exception still occurs on 2.4RC. It looks like 2.3 is breaking BC for plugins.
Composer diagnose
$ composer diagnose Checking composer.json: OK Checking platform settings: OK Checking git settings: OK git version 2.25.1 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.4.0-RC1 PHP version: 7.2.24 - Package overridden via config.platform, actual: 7.4.3 PHP binary path: /usr/bin/php7.4 OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 cURL version: 7.68.0 libz 1.2.11 ssl OpenSSL/1.1.1f zip: extension present, unzip present, 7-Zip present (7z)
Exception
$ composer u
[Studio] Loading path ../***
Loading composer repositories with package information
In ProcessExecutor.php line 166:
[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:166
Composer\Util\ProcessExecutor->executeAsync() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:331
Composer\Package\Version\VersionGuesser->guessFeatureVersion() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:188
Composer\Package\Version\VersionGuesser->guessGitVersion() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionGuesser.php:84
Composer\Package\Version\VersionGuesser->guessVersion() at phar:///usr/local/bin/composer/src/Composer/Repository/PathRepository.php:215
Composer\Repository\PathRepository->initialize() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:311
Composer\Repository\ArrayRepository->getPackages() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:62
Composer\Repository\ArrayRepository->loadPackages() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:391
Composer\DependencyResolver\PoolBuilder->loadPackagesMarkedForLoading() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:240
Composer\DependencyResolver\PoolBuilder->buildPool() at phar:///usr/local/bin/composer/src/Composer/Repository/RepositorySet.php:334
Composer\Repository\RepositorySet->createPool() at phar:///usr/local/bin/composer/src/Composer/Installer.php:473
Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:289
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:243
Composer\Command\UpdateCommand->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:1024
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:335
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:88
require() at /usr/local/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>...]
tested with composer 2.3.10 on PHP 8.1 and 7.4 and for me it fixes the problem
This indeed looks like a BC in Composer / we weren't using it correctly the whole time.
The getLoop()
method is around since 2.0 (https://github.com/composer/composer/commit/557fb873ee10c413bbd86d8c820c063c2b871a43), but we unfortunately still need the check as we also support v1.
@baukevdw could you maybe add a comment, that this is basically a if v2 else v1
?
@baukevdw apparently I don't understand how to add commits to your PR, so I created a PR in your fork to include into this PR: https://github.com/baukevdw/studio/pull/1
With this we can merge the changes.
@apfelbox You should be able to push directly to my branch since I enabled 'Allow edits by maintainers'. But I've merged your pull-request.
@baukevdw then maybe the Github CLI was just trolling me. 😄
Thank you for your contribution 🙌
I just released 0.16.0
containing this fix.
Thanks!