I had earlier posted this in the thread "Losing all non-community tag term data when adding..." but in fact it does not seem related to that.

I get the following error message after I submit a user-generated tag. However, the submitted tag is added and there does not appear to be any problem with the module's functionality:


warning: Cannot modify header information - headers already sent by (output started at C:\apache2triad\htdocs\ripsift\modules\community_tags\community_tags.module:424) in C:\apache2triad\htdocs\ripsift\includes\common.inc on line 141.

CommentFileSizeAuthor
#6 header_output.patch816 bytesWill White

Comments

Steven’s picture

Status: Active » Fixed
wmech’s picture

Status: Fixed » Active

Hi.

I think this is a common problem.
We are working now, on our GSM content website for polish market, and Drupal is realy great.
Everything works perfectly, except this issue.

We have:
Drupal 5.1
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch3
PHP 5.2.0-8+etch3
MySQL 5.0.32

After adding tag (it works, no problems), and clicking any link, we have this warning message:

warning: Cannot modify header information - headers already sent by (output started at
/modules/community_tags/community_tags.module:424) in
/includes/common.inc on line 141.

If anyone can help, please do it.

patchak’s picture

Exact same error for me on php4 and mysql 4.0. The error goes away after a refresh, using the latest dev tarball...

patchak’s picture

i can confirm this is not fixed and happens on every install of this module... I wonder why was this passed to fixed state without an explanation or some advice??

Patchak

Will White’s picture

The problem is caused by some code beginning on line 424 (as the error indicates). The call to set headers is occurring after the actual content is printed. But, headers go before content. Just reverse the two lines. I'll post a patch later today, but for now:

Starting on line 424, change

// Output JSON
  print drupal_to_js(array('status' => TRUE, 'tags' => $tags, 'sequence' => $_POST['sequence']));
  drupal_set_header('Content-Type: text/javascript; charset=utf-8');

To

  // Output JSON
  drupal_set_header('Content-Type: text/javascript; charset=utf-8');
  print drupal_to_js(array('status' => TRUE, 'tags' => $tags, 'sequence' => $_POST['sequence']));
Will White’s picture

Status: Active » Needs review
StatusFileSize
new816 bytes

Here is the patch.

patchak’s picture

Thanks, that patch solved the problem.

dropcube’s picture

Status: Needs review » Fixed

I can not reproduce the issue in the current development version. If you guys still have the problem reported, please re-open it.

dropcube’s picture

Title: Tagging nodes results in error message » Tagging nodes results in error message - warning: Cannot modify header information
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.