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

cv upgrade:db failed on 5.47.0 codebase #112

Closed
artfulrobot opened this issue Mar 10, 2022 · 11 comments
Closed

cv upgrade:db failed on 5.47.0 codebase #112

artfulrobot opened this issue Mar 10, 2022 · 11 comments

Comments

@artfulrobot
Copy link
Contributor

version: cv v0.3.18

Moving from 5.36.1 to 5.47.0, i.e. have replaced the civicrm/ dir, and want to run the db upgrade I got this error:

(messages about templates...)
Press ENTER to continue                                                                                                                                                                          
Error: Call to undefined method Symfony\Component\Console\Question\ConfirmationQuestion::getAutocompleterCallback() in Symfony\Component\Console\Helper\QuestionHelper->doAsk() (line 109 of phar
:///usr/local/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php).                                                                                                                          

I was able to run the upgrade through using drush civicrm-upgrade-db instead.

Not sure if I did something wrong, or if this is a bug?

@demeritcowboy
Copy link
Contributor

I had a similar but different problem and it was that I somehow had a mismatched version of symfony/console and needed to run composer install.

totten/civix#236 (comment)

@artfulrobot
Copy link
Contributor Author

Run composer install where?

I had cv downloaded as the phar and was upgrading a D7-based civi site (not composer based).

@demeritcowboy
Copy link
Contributor

Oh ok this might be different then - I had it built from source. For what it's worth I just tried the 0.3.18 phar and the ConfirmationQuestion worked ok here.

@totten
Copy link
Member

totten commented Mar 10, 2022

Yeah, I'm having trouble reproducing as well. Worked for me on D7+WP using v0.3.18.

A few sanity checks to try:

## Check both version and md5sum of PHAR.

$ cv --version
cv v0.3.18

$ md5sum `which cv`
873d89af61cc2810dd76793bc63575d2  /Users/totten/bknix/bin/cv

## PHP version

$ php --version
PHP 7.4.26 (cli) (built: Nov 28 2021 18:18:12) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.26, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans

## Check content of phar - it should have class `ConfirmationQuestion` and its parent `Question`

$ phar list -f `which cv` | grep vendor.*Question
  | | | |-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php
  | | | |-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Helper/SymfonyQuestionHelper.php
  | | |-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Question
  | | | |-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Question/ChoiceQuestion.php
  | | | |-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php
  | | | \-phar:///Users/totten/bknix/bin/cv/vendor/symfony/console/Question/Question.php

## Check that the file has the functions

$ mkdir /tmp/z ; phar extract -f `which cv` -i 'Question' /tmp/z
//Users/totten/bknix/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php ...ok
//Users/totten/bknix/bin/cv/vendor/symfony/console/Helper/SymfonyQuestionHelper.php ...ok
//Users/totten/bknix/bin/cv/vendor/symfony/console/Question/ChoiceQuestion.php ...ok
//Users/totten/bknix/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php ...ok
//Users/totten/bknix/bin/cv/vendor/symfony/console/Question/Question.php ...ok

$ grep -r getAutocompleterCallback /tmp/z
/tmp/z/Users/totten/bknix/bin/cv/vendor/symfony/console/Question/Question.php:$callback = $this->getAutocompleterCallback();
/tmp/z/Users/totten/bknix/bin/cv/vendor/symfony/console/Question/Question.php:public function getAutocompleterCallback(): ?callable
/tmp/z/Users/totten/bknix/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php:$autocomplete = $question->getAutocompleterCallback();

$ grep -r 'class ConfirmationQuestion' /tmp/z
/tmp/z/Users/totten/bknix/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php:class ConfirmationQuestion extends Question

@artfulrobot
Copy link
Contributor Author

Snap, I get the same, I think. But I'm on php 7.4.28

rich@pap1:~% cv --version
cv v0.3.18

rich@pap1:~% md5sum `which cv`
873d89af61cc2810dd76793bc63575d2  /usr/local/bin/cv

rich@pap1:~% php --version
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

rich@pap1:~% phar list -f `which cv` | grep vendor.\*Question
  | | | |-phar:///usr/local/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php
  | | | |-phar:///usr/local/bin/cv/vendor/symfony/console/Helper/SymfonyQuestionHelper.php
  | | |-phar:///usr/local/bin/cv/vendor/symfony/console/Question
  | | | |-phar:///usr/local/bin/cv/vendor/symfony/console/Question/ChoiceQuestion.php
  | | | |-phar:///usr/local/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php        #### :eyes: 
  | | | \-phar:///usr/local/bin/cv/vendor/symfony/console/Question/Question.php

rich@pap1:~% mkdir /tmp/z ; phar extract -f `which cv` -i 'Question' /tmp/z
//usr/local/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php ...ok
//usr/local/bin/cv/vendor/symfony/console/Helper/SymfonyQuestionHelper.php ...ok
//usr/local/bin/cv/vendor/symfony/console/Question/ChoiceQuestion.php ...ok
//usr/local/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php ...ok
//usr/local/bin/cv/vendor/symfony/console/Question/Question.php ...ok

rich@pap1:~% grep -r getAutocompleterCallback /tmp/z
/tmp/z/usr/local/bin/cv/vendor/symfony/console/Question/Question.php:$callback = $this->getAutocompleterCallback();
/tmp/z/usr/local/bin/cv/vendor/symfony/console/Question/Question.php:public function getAutocompleterCallback(): ?callable
/tmp/z/usr/local/bin/cv/vendor/symfony/console/Helper/QuestionHelper.php:$autocomplete = $question->getAutocompleterCallback();

rich@pap1:~% grep -r 'class ConfirmationQuestion' /tmp/z
/tmp/z/usr/local/bin/cv/vendor/symfony/console/Question/ConfirmationQuestion.php:class ConfirmationQuestion extends Question

@artfulrobot
Copy link
Contributor Author

Nb. it's happy to run now there's nothing to do.

sudo -u wwwone /usr/local/bin/cv upgrade:db
Found CiviCRM database version 5.47.0.
Found CiviCRM code version 5.47.0.
Array
(
    [latestVer] => 5.47.0
    [message] => You are already upgraded to CiviCRM 5.47.0
    [text] => You are already upgraded to CiviCRM 5.47.0
)

@demeritcowboy
Copy link
Contributor

A possibility: Drupal 8+ has its own version of symfony/console. If it's a different version, and for whatever reason its version of Question.php gets autoloaded earlier, then if cv's version of QuestionHelper.php gets loaded later there's a mismatch. This might be more likely if it was originally a Drupal 8 site (as opposed to Drupal 9).

@artfulrobot
Copy link
Contributor Author

Yeah, but my site was a D7 one!

@artfulrobot
Copy link
Contributor Author

I'm going to close this, I'll reopen if it reoccurs - I'm doing lots of upgrades at the mo.

@artfulrobot
Copy link
Contributor Author

I had the same trouble today upgrading a client's site from 5.49 to 5.57 on d7, cv v0.3.30. (Note that drush civicrm-upgrade-db ran through fine, though it's not as nice as it doesn't warn about replacing msgTemplates)

link to embarrassing chat

@artfulrobot
Copy link
Contributor Author

Solution: totten/civix#299 (comment)

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