These error will throw out after exporting discount report into CSV files:
Warning: Missing argument 2 for drupal_add_http_header(), called in /home/test/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.admin.inc on line 1234 and defined in drupal_add_http_header() (line 1145 of /home/test/public_html/includes/bootstrap.inc).
Notice: Undefined variable: value in drupal_add_http_header() (line 1152 of /home/tazbeau1/public_html/includes/bootstrap.inc).
Notice: Undefined variable: value in drupal_add_http_header() (line 1161 of /home/tazbeau1/public_html/includes/bootstrap.inc).
In Drupal 7, drupal_add_http_header() required two argument, which should be replace bunch of code in uc_discounts.admin.inc:
$http_headers = array(
'Pragma: no-cache',
'Expires: 0',
'Cache-Control: no-cache, must-revalidate',
'Cache-Control: private',
'Content-Transfer-Encoding: binary',
'Content-Disposition: attachment; filename="discount_usage_report.csv"',
'Content-Type: text/csv',
);
foreach ($http_headers as $http_header) {
$http_header = preg_replace('/\r?\n(?!\t| )/', '', $http_header);
drupal_add_http_header($http_header);
}
To:
drupal_add_http_header('Pragma', 'no-cache');
drupal_add_http_header('Expires', 0);
drupal_add_http_header('Cache-Control', 'no-cache, must-revalidate');
drupal_add_http_header('Cache-Control', 'private');
drupal_add_http_header('Content-Transfer-Encoding', 'binary');
drupal_add_http_header('Content-Disposition', 'attachment; filename="discount_usage_report.csv"');
drupal_add_http_header('Content-Type', 'text/csv');
Comment | File | Size | Author |
---|---|---|---|
#5 | uc_discounts_alt-missing_argument_2_for_drupal_add_http_header-2471034-2.patch | 1.27 KB | alexdevelop |
Comments
Comment #1
alexdevelop CreditAttribution: alexdevelop as a volunteer and at Drupal Ukraine Community, DevBranch commentedThere is a patch to fix Error: ArgumentCountError: Too few arguments to function drupal_add_http_header() in uc_discounts_alt module.
Comment #4
alexdevelop CreditAttribution: alexdevelop as a volunteer and at Drupal Ukraine Community, DevBranch commentedComment #5
alexdevelop CreditAttribution: alexdevelop as a volunteer and at Drupal Ukraine Community, DevBranch commentedPatch to fix Error: ArgumentCountError: Too few arguments to function drupal_add_http_header() of uc_discounts_alt module.