When modernizr is enabled, drush commands like `drush cc` doesn't work, producing error:

Drush command terminated abnormally due to an unrecoverable error. [error]

This doesn't work too:
$ drush -v -d status -- crashes at `Drush bootstrap phase : _drush_bootstrap_drupal_full()`

Also, before error message I see the whole HTML page code printed in console.

Comments

rupl’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I am using the dev branch on a couple sites and have never encountered this problem, nor on a fresh install.

Please provide instructions to reproduce.

Anonymous’s picture

Version: 7.x-3.x-dev » 7.x-2.0
Status: Postponed (maintainer needs more info) » Active

I can confirm that this also has happened with me. I'm running a multisite drupal configuration and I have installed the module exactly as per the description on modernizr module page under sites/.../libraries/modernizr/modernizr.min.js (since I'm using the libraries module)... additionally I installed the development version as suggested by the modernizr website, here is the link to the file Development Version . When I enable the module and run a "drush cc all" the terminal gives "Drush command terminated abnormally due to an unrecoverable error. [error]" .

If anyone finds out what I'm doing wrong or if this is an issue, please let me know.

rupl’s picture

Status: Active » Postponed (maintainer needs more info)

Hi, thanks for reporting the issue!

I still need something to start debugging since I've never seen this problem. If you could provide a log of your actions on the console, or maybe a stack trace or something that indicates a detailed problem besides "it doesn't work" I will be more than happy to investigate. The info provided in this issue so far is unfortunately not enough to help me fix the problem. Reverting status to retain accuracy.

Here's my log of the problem NOT occurring, to show you an example of what I'm looking for. In your case I'd expect to see some errors:

fkchris$ cd Sites/modernizr/
fkchris$ drush cc all
'all' cache was cleared                                    [success]
fkchris$ 

Since I'm unable to reproduce the problem with the standalone module, I'm guessing it has to do with an interaction between the Modernizr module and another common Drupal module. If everyone in the issue could provide some useful info we can begin to see the consistencies between your situations and perhaps uncover the problem. Thanks!

Anonymous’s picture

Hi rupl,

I think I know what the problem is... . Try enabling the "Modernizr force redirect" on the modules page as well. After that try running "drush cc all" . It should give you an error. The error has disappeared for me after disabling this feature of the module.

Perhaps that's the point of force redirect to begin with which forces the modernizr cookie to be always available and therefore preventing from clearing the cache. Either way, I think it would be helpful for developers to know that this might happen if "Modernizr force redirect" is also enabled. Cheers.

rupl’s picture

Title: Modernizr breaks drush » modernizr_forceredirect breaks drush commands
Version: 7.x-2.0 » 7.x-2.x-dev
Status: Postponed (maintainer needs more info) » Active

Alright, thanks for the additional info! Yes, I am now seeing the issue. I never use this component of the module for clients, and thus hadn't ever encountered it.

After enabling modernizr_forceredirect, when I ran `drush cc all` I saw the HTML output of followed by the "Drush command terminated abnormally due to an unrecoverable error." This is using Drush 4.5.

The obvious quick-fix seems to be avoiding the use of modernizr_forceredirect, and to use Modernizr as a client-side library only, as it was intended. In fact, this is my recommendation regardless of technical issues with the module. I will discuss with @Yorirou how we can get this module to play nice with Drush, if at all. We will add some documentation in the mean time to help people avoid this inconvenient situation.

tamasd’s picture

Assigned: Unassigned » tamasd
Status: Active » Needs review

Origianlly I have started the force redirect module in order to make it easier to use the server side library. It is an experimental project which is not finished, so I recommend removing it from the stable version. It does not affect the server side functionality of the modernizr module, and currently it just breaks sites and confuses users.

Removing it temporarly is easier than fix it, because it meant to address a quite complex problem (make sure that a javascript is run on a client side before your PHP module code runs). I'll make a new release with the module removed.

rupl’s picture

Version: 7.x-2.x-dev » 7.x-2.1
Status: Needs review » Closed (fixed)

Yorirou has published the 7.x-2.1 release which does not contain modernizr_forceredirect submodule.