Ticket #1483926 (closed Patches: fixed)

Opened 2 years ago

Last modified 16 months ago

PHP Warning: Cannot modify header information appearing in httpd-error.log

Reported by: fak3r@… Owned by: thomasb
Priority: 5 Milestone: 0.1-rc2
Component: PHP backend Version: svn-trunk
Severity: normal Keywords: php headers warning modify
Cc:

Description

Using today's trunk (r288) I recieve these errors when navigating folders or reading emails in Roundcube.

[Sat Jun 17 12:37:22 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 12:37:22 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 12:37:28 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 12:37:28 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:22 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:22 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:27 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:27 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:34 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:34 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:45 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:45 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:52 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:05:52 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:06:00 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:06:00 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:06:29 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:06:29 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[Sat Jun 17 15:06:39 2006] [error] [client 192.168.1.11] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0

...

As you can see from the times it happens pretty consistantly. I'm running PHP 5.x, Apache 2.0.58.x on FreeBSD 6.1. Need more info just email me, thanks.

Change History

Changed 2 years ago by maildaemon

  • severity changed from normal to critical

This one still happens in beta 2.
The effect here seems to be that any multipart message cannot be displayed (i.e. all!).
Cheers.
Paul


[24-Aug-2006 11:05:34] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[24-Aug-2006 11:05:36] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[24-Aug-2006 11:05:36] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[24-Aug-2006 11:05:54] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[24-Aug-2006 11:05:54] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0

Changed 2 years ago by zyzzyvas

I am seeing this too. I think it has to do with blank spaces being inserted before PHP header() statements...I bet one (or more) of the PHP files has a stray space at the end or something.

Should be an easy fix.

Changed 2 years ago by mnmr

I have fixed this locally by removing the TRUE parameter from program/steps/getunread.inc (line 31).

Seems it was not space related after all ;-)

Changed 2 years ago by thomasb

Cannot reproduce, headers should only be sent once. Can you post your PHP version/configuration?

Changed 2 years ago by squishy

I can verify that the solution by mnmr solved it for me also.

Change program/steps/getunread.inc from

31     rcube_remote_response($commands, TRUE);

to

31     //rcube_remote_response($commands, TRUE);
32     rcube_remote_response($commands);

Thanks

Changed 23 months ago by kajtzu@…

  • version changed from 0.1-beta to svn-trunk

this is needed for svn-trunk, too. file is now program/steps/mail/getunread.inc

Changed 22 months ago by zyzzyvas

My setup is Apache 2.2.4, PHP 5.2.0 (with Zend Optimizer 3.2.2 and Suhosin Patch 0.9.6.1), MySQL 5.0.33 on FreeBSD 6.2-RELEASE.

Changing line 31 in program/steps/mail/getunread.inc reduces the frequency of the errors, but I still get some. Evidently I'm not the only one still seeing them (see #1484220).

Changed 20 months ago by thomasb

  • owner set to thomasb
  • status changed from new to assigned
  • severity changed from critical to normal
  • milestone set to 0.1-rc2

Seems to be a rcube_remote_response() issue, but only on PHP 5. Client-server communication is subect to be changed in devel-addressbook branch. Will test this later on.

Ticket #1484220 marked as duplicate of this bug.

Changed 20 months ago by moc

I've resolved this problem deleting the line 1980 in /program/lib/imap.inc.

Test it and then close the ticket if it works.

Changed 20 months ago by r@…

After deleting line 1980 in /program/lib/imap.inc two days ago, I haven't seen any more "Cannot modify header" error messages. Previously I would see dozens of these per day.

Changed 20 months ago by r@…

  • type changed from Bugs to Patches

In two weeks of "production" usage with 60 users, I have not seen one instance of "Cannot modify header information" in the error log since removing "flush();" from imap.inc. Moc's patch is as follows:

*** program/lib/imap.inc     Sat Dec 30 07:03:15 2006
--- program/lib/imap.inc.new Thu Apr 12 10:43:11 2007
***************
*** 1977,1983 ****
        if (fputs($fp, $request)){
                $line=iil_ReadLine($fp, 100);
                $sent = fwrite($fp, $message."\r\n");
-               flush();
                do{
                        $line=iil_ReadLine($fp, 1000);
                }while($line[0]!="A");
--- 1977,1982 ----

Changed 20 months ago by r@…

I should mention that the specific error message that removing flush(); fixed is:

PHP Warning: Cannot modify header information - headers already sent in /usr/local/apache2/htdocs/program/include/rcube_shared.inc on line 143

I never saw the originally reported error message:

PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0

Changed 16 months ago by thomasb

  • status changed from assigned to closed
  • resolution set to fixed

Should be fixed by removing UTF-8 BOM from localization files in r644

Note: See TracTickets for help on using tickets.