Problem:
------------------------------
The following warnings are generated in a freshly installed Drupal 5.7 site with only DBFM (+dependencies) added:

# warning: Cannot modify header information - headers already sent by (output started at C:\bin\portable_xampp\htdocs\bare-drupal-5.7\sites\all\modules\contrib\dbfm\dbfm.module:1002) in C:\bin\portable_xampp\htdocs\bare-drupal-5.7\includes\common.inc on line 141.

Happens when clicking on the Administer >> Site Configuration menu link.

The code at line 1002 is
echo drupal_to_js($var);

, with the whole function being:

function dbfm_json($var = NULL) {
// We are returning JavaScript, so tell the browser.
drupal_set_header('Content-Type: text/javascript; charset=utf-8');

if (isset($var)) {
echo drupal_to_js($var);
}
}

Fix(?):
------------------------------
A logical fix seemed:

function dbfm_json($var = NULL) {
if (isset($var)) {
// We are returning JavaScript, so tell the browser.
drupal_set_header('Content-Type: text/javascript; charset=utf-8');

echo drupal_to_js($var);
}
}

, which did fix the problem but I've only been looking at DBFM for the past 3 hours so perhaps someone who is a higher authority on the DBFM source code should confirm and commit it?

Comments

rooey’s picture

Thanks for that! We'll look into it.

In the mean time, version 5.x.3.0 was released yesterday - take a look!

rooey’s picture

Status: Active » Needs review
rooey’s picture

Title: DBMF: 'headers already sent' error from dbfm.module:1002, function dbfm_json » DBFM: 'headers already sent' error from dbfm.module:1002, function dbfm_json
rooey’s picture

Version: 5.x-2.2 » 5.x-3.0
Status: Needs review » Fixed
rooey’s picture

Status: Fixed » Closed (fixed)