Skip to content

Commit

Permalink
Fixes #3351: site-install Drupal 7 with PHP 7.2 (#3353)
Browse files Browse the repository at this point in the history
* Fixes #3351: Always use 'fwrite' instead of 'print' in 'drush_print' to avoid undesired interaction with PHP's handling of the php headers.

* Continue to capture output in the backend results.
  • Loading branch information
greg-1-anderson authored Feb 5, 2018
1 parent 0af8928 commit a97c1d1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions includes/output.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ function drush_print($message = '', $indent = 0, $handle = NULL, $newline = TRUE
if (($charset = drush_get_option('output_charset')) && function_exists('iconv')) {
$msg = iconv('UTF-8', $charset, $msg);
}
if (isset($handle)) {
fwrite($handle, $msg);
}
else {
print $msg;
}
if (!isset($handle)) {
$handle = STDOUT;
// In the past, Drush would use `print` here; now that we are using
// fwrite (to avoid problems with php sending the http headers), we
// must explicitly capture the output, because ob_start() / ob_end()
// does not capture output written via fwrite to STDOUT.
drush_backend_output_collect($msg);
}
fwrite($handle, $msg);
}

/**
Expand Down

0 comments on commit a97c1d1

Please sign in to comment.