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');
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexdevelop’s picture

There is a patch to fix Error: ArgumentCountError: Too few arguments to function drupal_add_http_header() in uc_discounts_alt module.

alexdevelop’s picture

alexdevelop’s picture

Patch to fix Error: ArgumentCountError: Too few arguments to function drupal_add_http_header() of uc_discounts_alt module.