-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
php-eval fails with Call to undefined function drupal_get_installed_schema_version() #4511
Comments
Looks like drush did not find your drupal root. Pass --root option or navigate there before running drush. If you think drush should be recognizing root but isnt. See https://github.com/webflo/drupal-finder, which we depend on. |
That was running from the root, and adding --root didn't make a difference. Drupal-finder looks for composer.json, which was deleted (drupal was not installed using composer). Should I replace with the one that comes with d9? |
Drush 9+ is not supported outside of a Composer assembled project. See Drush's install instructions. Dont bother merely putting a composer.json file in place. You need to actually use |
It actually works fine to let composer create a new composer.json, since it's not actually used for anything and just needs to parse as valid. Drush commands work fine now. Seems to me expected behavior would be at least a warning that it can't find composer.json and/or it can't find the drupal root dir, and at the very least accept the cwd as the drupal root when not specified explicitly (although --root fails as well). That is somewhat circular that it can't find the root, before it accepts the --root flag. |
Some parts of Drush work fine. Some don't. Thats what we mean by unsupported. |
Drush will try a bunch of different things to find the root. The point above is that the only supported installation method is installing Drupal with Composer, and then installing Drush as a site-local dependency of the Drupal site. Other configurations can be made to work, but you're on your own. Finding the root from the cwd should typically work. We can consider pull requests to fix bootstrapping issues, but we won't investigate and resolve these issues ourselves, and we won't necessarily accept a PR if it complicates the supported case or is too much of an edge case. |
Describe the bug
Call to undefined function drupal_get_installed_schema_version()
To Reproduce
install drush with composer
Expected behavior
success
Actual behavior
[www]$ ./vendor/bin/drush -vvv php-eval "echo drupal_get_installed_schema_version('module');"
[preflight] Config paths: /path/www/vendor/drush/drush/drush.yml
[preflight] Alias paths:
[preflight] Commandfile search paths: /path/www/vendor/drush/drush/src
[debug] Starting bootstrap to max [0.05 sec, 8.13 MB]
[debug] Trying to bootstrap as far as we can [0.05 sec, 8.14 MB]
PHP Fatal error: Uncaught Error: Call to undefined function drupal_get_installed_schema_version() in /path/www/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code:1
Stack trace:
#0 /path/www/vendor/drush/drush/src/Commands/core/PhpCommands.php(29): eval()
#1 [internal function]: Drush\Commands\core\PhpCommands->evaluate('echo drupal_get...', Array)
#2 /path/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#3 /path/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /path/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /home in /path/www/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code on line 1
[warning] Drush command terminated abnormally. [0.05 sec, 8.24 MB]
Workaround
no
System Configuration
Drush version : 10.3.2
PHP: 7.3.15
MySQL: 8.0.19
Linux
Additional information
[www]$ ./vendor/bin/drush -vvv status
[preflight] Config paths: /path/www/vendor/drush/drush/drush.yml
[preflight] Alias paths:
[preflight] Commandfile search paths: /path/www/vendor/drush/drush/src
[debug] Starting bootstrap to max [0.05 sec, 8.13 MB]
[debug] Trying to bootstrap as far as we can [0.05 sec, 8.13 MB]
PHP binary : /usr/bin/php
PHP config : /etc/php.ini
PHP OS : Linux
Drush script : /path/www/vendor/drush/drush/drush
Drush version : 10.3.2
Drush temp : /tmp
Drush configs : /path/www/vendor/drush/drush/drush.yml
The text was updated successfully, but these errors were encountered: