Download & Extend

conflict with drush (headers already sent)

Project:Secure Pages
Version:6.x-1.8
Component:Miscellaneous
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

Comments

#1

Status:active» postponed (maintainer needs more info)

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

#2

Status:postponed (maintainer needs more info)» needs review

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.

AttachmentSize
securepages-599948.patch 2.52 KB

#3

I'll investigate over the weekend.

Best,
Paul Booker
Appcoast

#4

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

if (php_sapi_name() == 'cli') {
  return;
}

#5

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.

#6

gorden...see #4

#7

Yes, but I still need a patch.

#8

Status:needs work» needs review

Subscribing. Patch for solution in #4 attached.

AttachmentSize
securepages-drush.patch 747 bytes

#9

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.

#10

Keeping track of this thread...

#11

Subscribing.

#12

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.

#13

Priority:critical» normal

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

#14

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.

#15

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:)

#16

Status:reviewed & tested by the community» fixed

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

#17

Status:fixed» closed (fixed)

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

nobody click here