Attempted to install modernizr module using: drush pm-enable modernizr.

Site crashed and received following error:

PHP Fatal error: Call to undefined function _modernizr_scan_for_library() in /var/www/html/sites/all/modules/modernizr/drush/modernizr.drush.inc on line 98
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function _modernizr_scan_for_library() in
/var/www/html/sites/all/modules/modernizr/drush/modernizr.drush.inc,

CommentFileSizeAuthor
#11 2127469-module-include.patch544 bytesrupl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Priority: Critical » Normal

Update. Site did not crash after all, lowered priority to normal. Error reported but module seems to be installed. cleared cache using "drush cc".

Anonymous’s picture

Title: Crashed site on install » Error: Call to undefined function _modernizr_scan_for_library()
rupl’s picture

That's quite strange since that function is in the .module file: http://drupalcode.org/project/modernizr.git/blob/refs/heads/7.x-3.x:/mod...

I see that the drush.inc calls it here: http://drupalcode.org/project/modernizr.git/blob/refs/heads/7.x-3.x:/dru...

I've never seen this error. Is there any additional information you could provide?

rupl’s picture

Status: Active » Postponed (maintainer needs more info)
Zsuffa Dávid’s picture

Same issue here. Drush install and enable followed by this error:

zsuffad@dev:/var/www/elite/sites/all$ drush dl modernizr
Project modernizr (7.x-3.2) downloaded to /var/www/elite/sites/all/modules/modernizr.                                                                                                                                             [success]
zsuffad@dev:/var/www/elite/sites/all$ drush en modernizr
The following extensions will be enabled: modernizr
Do you really want to continue? (y/n): y
modernizr was enabled successfully.  [ok]
PHP Fatal error:  Call to undefined function _modernizr_scan_for_library() in /var/www/elite/sites/all/modules/modernizr/drush/modernizr.drush.inc on line 98
PHP Stack trace:
PHP   1. {main}() /usr/share/drush/drush.php:0
PHP   2. drush_main() /usr/share/drush/drush.php:14
PHP   3. _drush_bootstrap_and_dispatch() /usr/share/drush/drush.php:59
PHP   4. drush_dispatch() /usr/share/drush/drush.php:90
PHP   5. call_user_func_array() /usr/share/drush/includes/command.inc:165
PHP   6. drush_command() /usr/share/drush/includes/command.inc:165
PHP   7. _drush_invoke_hooks() /usr/share/drush/includes/command.inc:198
PHP   8. call_user_func_array() /usr/share/drush/includes/command.inc:324
PHP   9. drush_modernizr_post_pm_enable() /usr/share/drush/includes/command.inc:324
PHP  10. _modernizr_drush_download_dev() /var/www/elite/sites/all/modules/modernizr/drush/modernizr.drush.inc:130
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                [error]
Error: Call to undefined function _modernizr_scan_for_library() in /var/www/elite/sites/all/modules/modernizr/drush/modernizr.drush.inc, line 98

Drupal version : 7.26
Drush version : 5.4

I have Libraries API enabled. The modernizr library has not downloaded.

Anonymous’s picture

@zsuffad try a drush cc all, that seemed to clear up the issue for me.

rupl’s picture

I'm sorry I can't figure out why this is happening. I took another look at this during DrupalCamp Frankfurt with 7.26 and I still can't reproduce. But I won't close until we can nail this down why it's happening.

cmonnow’s picture

I can confirm I had the same issue. I disabled and uninstalled the module before running "sudo drush cc all" and the subsequent installation progressed without errors.

(At first I thought it was some obscure new feature of Drupal/drush to block when a function with an underscore at the beginning of its name (to indicate internal/private functions) is called externally but I have no idea now).

leandro713’s picture

same crash here.
drush downloaded the module but not the library.
i installed the library with «drush mdl»

hass’s picture

Status: Postponed (maintainer needs more info) » Active

I think you need to module_load_include() the .module file. Otherwise Drush loads the drush.inc only and no other files what results such type of errors.

rupl’s picture

Status: Active » Needs review
FileSize
544 bytes

Thank you @hass for the suggestion. As I mentioned earlier in this issue, I have never been able to reproduce, so if someone could test this patch and RTBC I'm happy to commit.