hello,

securepages breakes the drush module http://drupal.org/project/drush with the following error:

user1@machine:~/html/drupal$ sites/all/modules/drush/drush update -l http://example.com -d
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.114 sec] [bootstrap]
Initialized Drupal 6.14 root directory at /home/www/user1/html/drupal [0.154 sec] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.156 sec] [bootstrap]
Initialized Drupal site example.com at sites/example.com [0.201 sec] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.203 sec] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.248 sec] [bootstrap]
Successfully connected to the Drupal database. [0.248 sec] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.279 sec] [bootstrap]
session_start(): Cannot send session cookie - headers already sent by (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.29 sec]
session_start(): Cannot send session cache limiter - headers already sent (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.291 sec]
Cannot modify header information - headers already sent by (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.349 sec]
Cannot modify header information - headers already sent by (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.349 sec]
Cannot modify header information - headers already sent by (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.349 sec]
Cannot modify header information - headers already sent by (output started at [warning]
/home/www/user1/html/drupal/sites/all/modules/drush/includes/drush.inc:439) [0.349 sec]
Drush command could not be completed. [0.635 sec]

deactivating securepages solves this error. It would be nice if this behaviour could will be fixed.

many thanks

best regards

Stefan

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this - appears to be working fine with drush locally.

jrglasgow’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.52 KB

I had the same problem, I tracked it down to Secure Pages outputting headers in hook_boot() and hook_init().

In my patch I checked to see if the drush_main() function exists, if so we return at the beginning of the hooks not outputting any headers.

Anonymous’s picture

I'll investigate over the weekend.

Best,
Paul Booker
Appcoast

mstef’s picture

I just put the following at the top of hook_init and hook_boot:

if (php_sapi_name() == 'cli') {
  return;
}
gordon’s picture

Status: Needs review » Needs work
+++ securepages.module	20 Feb 2010 04:03:15 -0000
@@ -10,6 +10,10 @@
+  if (function_exists('drush_main')) {
+    return NULL;
+  }

Shouldn't check for for the function drush_main(). Should check to see if php is running in a shell. Much more generic

+++ securepages.module	20 Feb 2010 04:03:15 -0000
@@ -46,7 +50,7 @@ function securepages_boot() {
-  if (!variable_get('securepages_enable', 0) || basename($_SERVER['PHP_SELF']) != 'index.php') {
+  if (!variable_get('securepages_enable', 0) || basename($_SERVER['PHP_SELF']) != 'index.php' || function_exists('drush_main')) {
     return;

Same as above.

Use php_sapi_name() instead. will make it much more generic. Will fix for all shell based bootstrapping of Drupal.

Powered by Dreditor.

mstef’s picture

gorden...see #4

gordon’s picture

Yes, but I still need a patch.

John Bickar’s picture

Status: Needs work » Needs review
FileSize
747 bytes

Subscribing. Patch for solution in #4 attached.

xjm’s picture

Status: Needs review » Reviewed & tested by the community

Ran into this issue when testing this module. I had to go into admin/build/modules in a browser (gasp!) and uncheck a box (gasp!) to turn the module off so I could use drush.

This patch applies fine and resolves the issue.

BenK’s picture

Keeping track of this thread...

debplatt’s picture

Subscribing.

christefano’s picture

Title: conflict with drush » conflict with drush (headers already sent)
Priority: Normal » Critical

#8 works for me.

Before:

$ drush --verbose cron
Initialized Drupal 6.19 root directory at /home/drupal/public_html        [notice]
Initialized Drupal site default at sites/default                        [notice]
Cannot modify header information - headers already sent by (output   [warning]
started at /home/drupal/public_html/drush/includes/drush.inc:820)
securepages.module:192
Drush command could not be completed.                                [error]

After:

$ drush.php --verbose cron  
Initialized Drupal 6.19 root directory at /home/drupal/public_html        [notice]
Initialized Drupal site default at sites/default                        [notice]
WD cron: Cron run completed.                                            [notice]
Cron run successfully.                                               [success]
Command dispatch complete                                               [notice]

This is critical for me but might not be for others, so feel free to lower priority.

xjm’s picture

Priority: Critical » Normal

The issue priorities are all specifically defined:
http://drupal.org/node/45111

christefano’s picture

Priority: Normal » Critical

Thanks for pointing out that page. It says:

Critical bugs either render a system unusable (not being able to create content or upgrade between versions, blocks not displaying, and the like), or expose security vulnerabilities. These bugs are to be fixed immediately.

I guess the word "system" is not defined enough for you? In short, this bug breaks Drush and therefore renders my system unusable. For example, I need to able to use Drush to run cron, perform routine maintenance, etc. and all my shell scripts containing Drush commands come to a halt.

Anyway, I said to feel free to lower the priority but I've changed my mind. If you still feel the same as you do in #13, do what you want.

jamesfk’s picture

Patch seems to work for me, but once applied I cannot get into the secure pages settings in a browser.

Has anyone else had this problem, or indeed checked afterwards?

EDIT: Had moved module into a site specific directory too and this was the problem. Patch working fine - thanks guys:)

grendzy’s picture

Status: Reviewed & tested by the community » Fixed

Committed a variation of this to 6.x and CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.