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

Call to undefined method when updating to 1.7.0 #122

Closed
phil-davis opened this issue Jul 11, 2022 · 2 comments
Closed

Call to undefined method when updating to 1.7.0 #122

phil-davis opened this issue Jul 11, 2022 · 2 comments

Comments

@phil-davis
Copy link
Contributor

Have a system with 1.6.0 already in composer.lock

$ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading bamarni/composer-bin-plugin (1.6.0 => 1.7.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Upgrading bamarni/composer-bin-plugin (1.6.0 => 1.7.0): Extracting archive
Generating optimized autoload files

In PluginManager.php(273) : eval()'d code line 119:
                                                                        
  [Error]                                                               
  Call to undefined method Bamarni\Composer\Bin\Config::fromComposer()  
                                                                        

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(273) : eval()'d code:119
 Bamarni\Composer\Bin\Plugin_composer_tmp0->onEvent() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(273) : eval()'d code:99
 Bamarni\Composer\Bin\Plugin_composer_tmp0->onPostAutoloadDump() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:202
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:125
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:432
 Composer\Autoload\AutoloadGenerator->dump() at phar:///usr/local/bin/composer/src/Composer/Installer.php:341
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:241
 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: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: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-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>...]

IMO the existing 1.6.0 does not have fromComposer available - that was added in #90 for 1.7.0

The workaround is to run composer update again, and this time it does not get any error.

I noticed the problem in automated CI stuff, in repos where there is already a committed composer.lock that has 1.6.0 (and other pinned dependencies), and the CI does composer update at some point. That falls over. I can manually make PRs for those to update to 1.7.0.

I wonder if there is a cleaner way to avoid this transition issue?

@dvaeversted
Copy link

Had the same error pop up on our pipelines aswell.

Shows out that updating composer itself, actually solves it since the "requireComposer()" method on the BaseCommand was added somewhere in between these versions:

Upgrading to version 2.3.9 (stable channel).
   
Use composer self-update --rollback to return to version 2.2.16

@phil-davis
Copy link
Contributor Author

@dvaeversted you are correct. I also had the problem in cs3org/reva#3063

https://drone.cernbox.cern.ch/cs3org/reva/7915/9/5

+ composer --version
Composer version 2.0.6 2020-11-07 11:21:17
+ composer self-update
Upgrading to version 2.3.9 (stable channel).
   
Use composer self-update --rollback to return to version 2.0.6
+ composer --version
Composer version 2.3.9 2022-07-05 16:52:11

everything runs fine with composer 2.3.9.

I had some trouble this morning locally with composer 2.3.5, so I think that a composer version >2.3.5 is needed.

2.3.9 is the latest and works.

To any readers, make sure to have the latest composer before using composer-bin-plugin 1.7.0

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