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

Cannot downgrade to version 1 if using PEAR #10049

Closed
fulldecent opened this issue Aug 11, 2021 · 2 comments
Closed

Cannot downgrade to version 1 if using PEAR #10049

fulldecent opened this issue Aug 11, 2021 · 2 comments
Labels
Milestone

Comments

@fulldecent
Copy link
Contributor

fulldecent commented Aug 11, 2021

In the documentation multiple times it is advertised: trying Composer 2 is easy, and you can quickly go back if it doesn't work. (One example is at https://blog.packagist.com/deprecating-composer-1-support/)

I tried it and found that going back is difficult if you are using PEAR.

Upgrading to try is easy:

php composer.phar self-update --2 
Updating to version 2.1.5 (2 channel).
   Downloading (100%)         
Use composer self-update --rollback to return to version 1.10.8

Downgrading failed

php composer.phar self-update --1

                                                          
  [RuntimeException]                                      
  The PEAR repository has been removed from Composer 2.0  
                                                          

It also failed using the above instructions shown when I upgraded:

php composer.phar self-update --rollback

                                                          
  [RuntimeException]                                      
  The PEAR repository has been removed from Composer 2.0  
                                                          

Intuitively I even expected upgrading might be a problem so I ran cp composer.* ~ before upgrading.

But reverting with mkdir tmp; mv composer.* tmp; cp ~/composer.* . did not work -- somehow the result is I am still running version 2.

End result is: can't upgrade, can't downgrade, some magic is preventing me from using composer at all.

@stof
Copy link
Contributor

stof commented Aug 11, 2021

well, as your phar is named composer.phar and you use composer.* in your mv and cp commands, you are also moving the phar, not only the config files.

@Seldaek
Copy link
Member

Seldaek commented Aug 18, 2021

As a workaround, you can add --version 1.10.22 to the setup instructions to install a specific version, i.e.:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --version 1.10.22
php -r "unlink('composer-setup.php');"

Or simply download a phar file you want for any version on https://getcomposer.org/download/

That said, it's a good point that self-update should not break if the composer.json is not supported. I'll have a look at what is causing that.

@Seldaek Seldaek added the Bug label Aug 18, 2021
@Seldaek Seldaek added this to the 2.1 milestone Aug 18, 2021
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