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

Updating to composer 2.2.1 replaced ocaramius package-version to 1.11.99 which causes this : Fatal error: Class PackageVersions\Installer contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) #32

Open
Rituparna007 opened this issue Dec 29, 2021 · 5 comments

Comments

@Rituparna007
Copy link

Hello

I have upgraded composer version to 2.2.1 and PHP version is 7.3.29. After upgrading I am getting this error

Installing ocramius/package-versions (1.5.1): Extracting archive
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.

Fatal error: Class PackageVersions\Installer contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in /var/www/book.grabrooms.com.dev.envoyer/releases/20211229142318/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 32
PHP Fatal error: Class PackageVersions\Installer contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in /var/www/book.grabrooms.com.dev.envoyer/releases/20211229142318/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 32

Can you please guide me how can I solve this issue?

@nicolas-grekas
Copy link

nicolas-grekas commented Dec 29, 2021

can you run the command with --no-plugins and share the output of composer why ocramius/package-versions please?
did you update Symfony deps also?

@Rituparna007
Copy link
Author

Output of composer why ocramius/package-versions

composer/package-versions-deprecated 1.11.99.4 replaces ocramius/package-versions (1.11.99)
ocramius/package-versions 2.5.0 replaces composer/package-versions-deprecated (*)

Can you please tell me should I run composer update with --no-plugins?
No I did not update Symfony deps.

@Seldaek
Copy link
Member

Seldaek commented Jan 3, 2022

Running composer update --no-plugins composer/package-versions-deprecated ocramius/package-versions should resolve it I'm hoping. The failure in OP is due to it installing 1.5.1 but that's a very old version I assume it came from your lock file?

@Rituparna007
Copy link
Author

Rituparna007 commented Jan 3, 2022 via email

@Seldaek
Copy link
Member

Seldaek commented Jan 3, 2022

Can you run the update I mentioned above, then run composer why -t ocramius/package-versions and share the output? Also make sure you commit the updated lock file so your deploy uses latest.

It seems to use 1.5.1 because you use PHP 7.3, and ocramius/package-versions 1.6+ requires PHP 7.4 or more, but that's why composer/package-versions-deprecated should be installed instead as that supports php 7.0+.

Maybe you need to explicitly require it if nothing else does require it. e.g. composer require composer/package-versions-deprecated, but the best would be to identify why ocramius/package-versions is needed and get rid of that IMO.

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

3 participants