Hi,

Recentyly I have encountered a strange problem. After adding a new own built module I got this warning.

-----
warning: Cannot modify header information - headers already sent by (output started at D:\Usr\WWW\Drupal\modules\advert\advert.module:1) in D:\Usr\WWW\Drupal\includes\common.inc on line 266.
-----

I can add remove and edit content but after hitting submitt i got a blank page. When I navigate back in a browser I can actually see changes were applied (plus i got a warning message). This scenario is applicable to any content of my site. When I administer site as an administrator and apply some settings or I act as an user trying to log on. Every time the same sheme submit, blank page, navigate back, changes were applied.

When I remove module from \modules folder everything gets back to normal.

I have tried to comment separate functions to track down one which is responsible for this problem.
Without any success. Only removal of module is effective.

Module is responsible for storing content about advertisements, here is a list of module functions:

function advert_help($section) {}
function advert_access($op, $advertisement) {}
function advert_menu($may_cache) {}
function advert_form(&$advertisement) {}
function advert_validate(&$advertisement) {}
function advert_insert($advertisement) {}
function advert_nodeapi(&$advertisement, $op, $teaser, $page) {}
function advert_delete($advertisement) {}
function advert_load($advertisement) {}
function advert_view(&$advertisement, $teaser = FALSE, $page = FALSE) {}
function theme_advert_order_info($advertisement) {}

Further nfo..

I had to add additional table 'advert' into MySql database.

I am runnig test website on Windows 2003 using Apahe 2.0.52 + PHP 4.3.11 + 4.1.12a.

I think problem might go deeper into some php configuration but i have no idea how to explain this strange bahaviour and dependency on one module.

Grtz

Comments

heine’s picture

warning: Cannot modify header information - headers already sent by (output started at D:\Usr\WWW\Drupal\modules\advert\advert.module:1) in D:\Usr\WWW\Drupal\includes\common.inc on line 266.

I've emphasized the important part of the message.

Make sure there is no preceding whitespace (emtpy line, spaces) before the first <?php tag in your module. A particularly insidious case of whitespace is the unicode Byte Order Mark; you need to configure your editor not to save it. You can see if the BOM is the cause using a hex editor (on Windows for example XVI32). In the case below (from another support request on drupal.org) you can see three extra bytes from the UTF-8 BOM before the opening <?php-tag:

EF BB BF 3C 3F 70 60 70 (<?php)

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

MichaelCole’s picture

Yep. That's it. Some editor/ftp program made it unicode. Good call!

B-Dot’s picture

That was indeed my problem.

I had just finished installing FCKEditor and was getting the error when trying to upload an image.

In doing a hex dump of the file

modules/fckeditor/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php

...I discovered the invisible, errant character cited above right before the opening <?PHP

Doing a "Save As" in BBEdit on the Mac, with "UTF-8, No BOM" fixed the problem.

The file in question was not modified by me - it came directly from the FCKeditor site.

I hope this saves someone else the many hours it took me to solve this obscure problem.

B-Dot

enboig’s picture

I have hundreds of files, is there an automatic way to search for these files?

La vida és una taronja, què esperes per exprimir-la?

Chris Star’s picture

What a headache that was giving me. Thanks for the insight and fix. XVI32 saved me.

joch’s picture

Muchas gracias esto me complico la vida durante muchas horas...