Closed (fixed)
Project:
Drush
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2009 at 00:47 UTC
Updated:
3 Jul 2009 at 16:12 UTC
If you are using drush, and add simpletest to your project, the snippet of code listed in INSTALL.txt is slightly broken because when using drush, $_SERVER['HTTP_USER_AGENT'] is an undefined index. This generates some output (a blank line? not sure); but it results in:
Notice: Undefined index: HTTP_USER_AGENT in /usr/local/www/drupal_sites/mvcares.org/settings.php on line 231 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 1029 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 1029 Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 630 Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 631 Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 632 Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/drupal_sites/mvcares.org/settings.php:231) in /usr/local/www/drupal6-cvs/includes/bootstrap.inc on line 633
This is alleviated by inserting an "@" in front of the $_SERVER or perhaps with an if isset e.g.:
$GLOBALS['simpletest_installed'] = TRUE;
if (isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match("/^simpletest\d+$/", $_SERVER['HTTP_USER_AGENT'])) {
$db_prefix = $_SERVER['HTTP_USER_AGENT'];
}
I also suspect that this does not show up unless php error_reporting is tuned up to E_ALL or some such.
Comments
Comment #1
boombatower commentedShouldn't drush just set it since it is creating an inconsistent environment.
Comment #2
moshe weitzman commentedThere is no http referer so I think drush is correct not to set this. Personally, I think simpletest's recommended php ought to become less noisy as you've suggested.
Comment #3
boombatower commentedhttp referer?
It is looking for
$_SERVER['HTTP_USER_AGENT']which there should always be...set to "drush"...maybe I'm not following?Comment #4
ericxb commentedI wondered about that myself. I agree drush should set the var; but I wasn't sure if it was correct to assume that USER_AGENT would always be set in the general case.
I will cross post this to the drush group as soon as I work thru their code and have a patch.
Comment #5
ericxb commentedThis seems to work as a drush patch:
Comment #6
moshe weitzman commentedwe now set this to NULL, which seems about right. please reopen if needed.
Comment #8
socialnicheguru commentedCan this be rerolled into a patch?
I use update regularly and I haven't seen an update for drush which would include this.
Or is it more likely that since drush is not longer a module, update does not pick it up?
C