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

Drush 8.1.15 install fails with php 7.2.2 #3351

Closed
ryanaslett opened this issue Feb 4, 2018 · 10 comments
Closed

Drush 8.1.15 install fails with php 7.2.2 #3351

ryanaslett opened this issue Feb 4, 2018 · 10 comments

Comments

@ryanaslett
Copy link

Howdy all. So, d7 doesnt work with php 7.2, or at least throws a lot of exceptions for deprecated each() and count() of non-countables. Except I cannot run a drush si using 8.1.15 for a d7 site on drupalci, thus we cant really fix these issues without a version of drush that will work. For some reason, the error messages I get are the following:

testbot:drupaltestbotpw@172.18.0.4/jenkins_drupal_d7_61404 --clean-url=0 --account-name=admin --account-pass=drupal --account-mail=admin@example.com
You are about to CREATE the 'jenkins_drupal_d7_61404' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /var/www/html/includes/module.inc:754
Stack trace:
#0 /var/www/html/includes/module.inc(954): module_implements('system_theme_in...')
#1 /var/www/html/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /var/www/html/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /var/www/html/includes/theme.maintenance.inc(57): list_themes()
#4 /var/www/html/includes/bootstrap.inc(2872): _drupal_maintenance_theme()
#5 /var/www/html/includes/errors.inc(179): drupal_maintenance_theme()
#6 /var/www/html/includes/bootstrap.inc(2609): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
thrown in /var/www/html/includes/module.inc on line 754
Drush command terminated abnormally due to an unrecoverable error.

I was able to install the site manually, and then run the tests, but drupalci has to use drush si to create a testable site.

@Chi-teck
Copy link
Collaborator

Chi-teck commented Feb 5, 2018

This is related to https://bugs.php.net/bug.php?id=75227

Starting Drupal installation. This takes a while. Consider using the --notify global option.

Seems like the message is sent before Drupal bootstrap process has begun, so ini_set fails to set some session settings. The simplest workaround is suppressing the output with --quiet option.

@ryanaslett
Copy link
Author

What do headers have to do with a CLI php script? Im confused as to how that relates.

@greg-1-anderson
Copy link
Member

Call to undefined function cache_get() looks more like a problem bootstrapping Drupal prior to the site-install to me, but I haven't had a chance to look at it yet.

@Chi-teck
Copy link
Collaborator

Chi-teck commented Feb 5, 2018

What do headers have to do with a CLI php script?

That is another PHP bug.
https://bugs.php.net/bug.php?id=42197

@Chi-teck
Copy link
Collaborator

Chi-teck commented Feb 5, 2018

One more solution to consider is printing this message conditionally for PHP < 7.2
https://github.com/drush-ops/drush/blob/8.1.15/commands/core/drupal/site_install_7.inc#L85

@greg-1-anderson
Copy link
Member

@Chi Have you confirmed that commenting out the message allows site-install to work correctly? A while ago we switched drush_print to use fwrite instead of print or echo, as that method apparently did not interact with the php headers. Is that perhaps no longer the case in php 7.2?

I'll run some tests and see if I can figure anything out about this.

@Chi-teck
Copy link
Collaborator

Chi-teck commented Feb 5, 2018

@greg-1-anderson Turns out the error was caused by another message.

You are about to DROP all tables in your '<table_mane>' database. Do you want to continue? (y/n):

Commenting out these three lines did the job for me.
https://github.com/drush-ops/drush/blob/8.1.15/commands/core/site_install.drush.inc#L159-L161

@Chi-teck
Copy link
Collaborator

Chi-teck commented Feb 5, 2018

Starting Drupal installation. This takes a while. Consider using the --notify global option.

You are about to DROP all tables in your '<table_mane>' database. Do you want to continue? (y/n):

The important difference between these two messages is that the first one is printed to stderror while the second one is printed to stdout.

@greg-1-anderson
Copy link
Member

It seems that we never switched drush_print to use fwrite instead of print. Making this adjustment allowed me to successfully install Drupal 7 using Drush 8.x with PHP 7.2.

I'll make a PR.

greg-1-anderson added a commit that referenced this issue Feb 5, 2018
…to avoid undesired interaction with PHP's handling of the php headers.
@greg-1-anderson
Copy link
Member

@ryanaslett Please try #3353 and see if it also does the trick for you.

greg-1-anderson added a commit that referenced this issue Feb 5, 2018
* Fixes #3351: Always use 'fwrite' instead of 'print' in 'drush_print' to avoid undesired interaction with PHP's handling of the php headers.

* Continue to capture output in the backend results.
@weitzman weitzman closed this as completed Feb 6, 2018
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

4 participants