$ ~/Documents/drupal/git/drush/drush --version
drush version 5.0-dev
$ ~/Documents/drupal/git/drush/drush status
 Drupal version         :  8.0-dev                             
 Default theme          :  garland                             
 Administration theme   :  garland                             
 PHP configuration      :  /private/etc/php.ini                
 Drush version          :  5.0-dev                             
 Drush configuration    :                                      
 Drush alias files      :                                      
 Drupal root            :  /Users/alan/Sites/drupal8-drushtest 

$ ~/Documents/drupal/git/drush/drush ev 'echo phpversion()'
5.3.6
$ ~/Documents/drupal/git/drush/drush si --db-su=root --db-su-pw='' --db-url=mysql://alandtest:pwqioehpoiuqherp918y234pr@127.0.0.1/d8drush
You are about to create a sites/default/files directory and create a sites/default/settings.php file and CREATE  the 'd8tesd8drush' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                                                                                                                   [ok]
PHP Fatal error:  Call to undefined function cache() in /Users/alan/Sites/drupal8-drushtest/includes/module.inc on line 640
PHP Stack trace:
PHP   1. {main}() /Users/alan/Documents/drupal/git/drush/drush.php:0
PHP   2. drush_main() /Users/alan/Documents/drupal/git/drush/drush.php:14
PHP   3. drush_dispatch() /Users/alan/Documents/drupal/git/drush/drush.php:82
PHP   4. call_user_func_array() /Users/alan/Documents/drupal/git/drush/includes/command.inc:216
PHP   5. drush_command() /Users/alan/Documents/drupal/git/drush/includes/command.inc:216
PHP   6. _drush_invoke() /Users/alan/Documents/drupal/git/drush/includes/command.inc:887
PHP   7. call_user_func_array() /Users/alan/Documents/drupal/git/drush/includes/command.inc:125
PHP   8. drush_core_site_install() /Users/alan/Documents/drupal/git/drush/includes/command.inc:125
PHP   9. drush_core_site_install_version() /Users/alan/Documents/drupal/git/drush/commands/core/site_install.drush.inc:145
PHP  10. install_drupal() /Users/alan/Documents/drupal/git/drush/commands/core/drupal/site_install.inc:60
PHP  11. install_begin_request() /Users/alan/Sites/drupal8-drushtest/includes/install.core.inc:76
PHP  12. drupal_language_initialize() /Users/alan/Sites/drupal8-drushtest/includes/install.core.inc:254
PHP  13. header() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2547
PHP  14. _drupal_error_handler() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2547
PHP  15. _drupal_error_handler_real() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2187
PHP  16. _drupal_log_error() /Users/alan/Sites/drupal8-drushtest/includes/errors.inc:86
PHP  17. watchdog() /Users/alan/Sites/drupal8-drushtest/includes/errors.inc:212
PHP  18. module_implements() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:1721
Drush command terminated abnormally due to an unrecoverable error.                                                                                                           [error]
Error: Call to undefined function cache() in /Users/alan/Sites/drupal8-drushtest/includes/module.inc, line 640

Second attempt with -d :

$ ~/Documents/drupal/git/drush/drush si -d --db-su=root --db-su-pw='' --db-url=mysql://alandtest:pwqioehpoiuqherp918y234pr@127.0.0.1/d8tesd8drush
Bootstrap to phase 0. [0.01 sec, 4.26 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 4.54 MB] [bootstrap]
Cache HIT cid: 5.0-dev-commandfiles-0-8e9949d150ae6fcdc96237c2a61b48aa [0.01 sec, 4.56 MB]                                                                                       [debug]
Bootstrap to phase 1. [0.04 sec, 9.52 MB]                                                                                                                                    [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 9.52 MB]                                                                                                   [bootstrap]
Initialized Drupal 8.0-dev root directory at /Users/alan/Sites/drupal8-drushtest [0.06 sec, 13.41 MB]                                                                           [notice]
Found command: site-install (commandfile=core) [0.06 sec, 13.41 MB]                                                                                                          [bootstrap]
Executing: mysql --database=d8tesd8drush --host=127.0.0.1 --user=alandtest --password=pwqioehpoiuqherp918y234pr -e "SELECT 1;" 2> /dev/null > /dev/null
You are about to DROP all tables in your 'd8tesd8drush' database. Do you want to continue? (y/n): y
Sites directory sites/default already exists - proceeding. [3.02 sec, 13.46 MB]                                                                                                 [notice]
Executing: mysql --database=d8tesd8drush --host=127.0.0.1 --user=alandtest --password=pwqioehpoiuqherp918y234pr -e "SELECT 1;" 2> /dev/null > /dev/null
Executing: mysql --database=d8tesd8drush --host=127.0.0.1 --user=alandtest --password=pwqioehpoiuqherp918y234pr  < /private/tmp/drush_zZ3vDH
No tables to drop. [3.05 sec, 13.46 MB]                                                                                                                                      [ok]
Starting Drupal installation. This takes a few seconds ... [3.05 sec, 14.13 MB]                                                                                              [ok]
PHP Fatal error:  Call to undefined function cache() in /Users/alan/Sites/drupal8-drushtest/includes/module.inc on line 640
PHP Stack trace:
PHP   1. {main}() /Users/alan/Documents/drupal/git/drush/drush.php:0
PHP   2. drush_main() /Users/alan/Documents/drupal/git/drush/drush.php:14
PHP   3. drush_dispatch() /Users/alan/Documents/drupal/git/drush/drush.php:82
PHP   4. call_user_func_array() /Users/alan/Documents/drupal/git/drush/includes/command.inc:216
PHP   5. drush_command() /Users/alan/Documents/drupal/git/drush/includes/command.inc:216
PHP   6. _drush_invoke() /Users/alan/Documents/drupal/git/drush/includes/command.inc:887
PHP   7. call_user_func_array() /Users/alan/Documents/drupal/git/drush/includes/command.inc:125
PHP   8. drush_core_site_install() /Users/alan/Documents/drupal/git/drush/includes/command.inc:125
PHP   9. drush_core_site_install_version() /Users/alan/Documents/drupal/git/drush/commands/core/site_install.drush.inc:145
PHP  10. install_drupal() /Users/alan/Documents/drupal/git/drush/commands/core/drupal/site_install.inc:60
PHP  11. install_begin_request() /Users/alan/Sites/drupal8-drushtest/includes/install.core.inc:76
PHP  12. drupal_language_initialize() /Users/alan/Sites/drupal8-drushtest/includes/install.core.inc:254
PHP  13. header() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2547
PHP  14. _drupal_error_handler() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2547
PHP  15. _drupal_error_handler_real() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:2187
PHP  16. _drupal_log_error() /Users/alan/Sites/drupal8-drushtest/includes/errors.inc:86
PHP  17. watchdog() /Users/alan/Sites/drupal8-drushtest/includes/errors.inc:212
PHP  18. module_implements() /Users/alan/Sites/drupal8-drushtest/includes/bootstrap.inc:1721
Drush command terminated abnormally due to an unrecoverable error.                                                                                                           [error]
Error: Call to undefined function cache() in /Users/alan/Sites/drupal8-drushtest/includes/module.inc, line 640 [3.06 sec, 16.69 MB]

Using drush 4.6-dev appears to succeed on site-install.

Comments

moshe weitzman’s picture

Status: Active » Closed (won't fix)

I think thats triggered by #673020: Tests for adding the Content-Language HTTP header to the generated page which is a core Drupal bug. Hopefully someone will work on its tests and get it committed.

There maybe a deeper Drupal problem though since it looks like cache system is not properly available at that early stage in the installer.

idflood’s picture

Status: Closed (won't fix) » Active

I confirm the "site-install" command fail with 5.x but works with 4.6. So why would it be a drupal core bug if only changing the drush version "fix" this?

In fact, the problem is maybe that with drush 5.x the settings.php file is created but the $databases array is empty.

sanduhrs’s picture

Title: drush site-install on Drupal 8 fails with a fatal error "Call to undefined function cache()" » drush site-install on Drupal 7.9 fails with a fatal error "Call to undefined function cache_get()"

As of release 7.9 this happens in Drupal 7, too.
The error changed slightly from "Call to undefined function cache()" to "Call to undefined function cache_get()"
Changed the title accordingly.

It has been introduced in http://drupalcode.org/project/drupal.git/commit/f429c271
Commenting line 2523 in bootstrap.inc fixes it.

Apllying the follow up patch in http://drupal.org/node/673020#comment-5106306 fixes it, too.

dtwork’s picture

On a fresh `drush si` of 7.9, I'm seeing the same failure reported here.

I can confirm

> Apllying the follow up patch in http://drupal.org/node/673020#comment-5106306 fixes it, too.

works as advertised; site-install is successful.

Gábor Hojtsy’s picture

I'd second the question from @idflood. If it only appears to be a problem with certain versions of Drush (+ not outside of Drush), how is it a core bug?

moshe weitzman’s picture

It is core Drupal's fault. Look at http://api.drupal.org/api/drupal/includes--install.core.inc/function/ins.... You can see that cache.inc is only included half way through the function. The problem is that any error that happens before then will fatal because _drupal_error_handler() eventually calls module_implements() which depends on cache subsystem. You can see the trail of tears in debug log in the original post here. Would be nice if we could handle errors before cache API is available.

timos’s picture

Same here with a drush-4.4 version and a drupal 7.9 install

> Apllying the follow up patch in http://drupal.org/node/673020#comment-5106306 fixes

i can confirm too that the patch fixes it on this older version so it seems confirm that it's a core issue

moshe weitzman’s picture

Category: bug » support
Status: Active » Closed (works as designed)

FYI, Drupal core fixed #673020: Tests for adding the Content-Language HTTP header to the generated page. Folks can use the Drupal 7.x dev snapshot until Drupal 7.10 is released.