php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13932 error_log and HTTP redirect using header confilt
Submitted: 2001-11-05 09:10 UTC Modified: 2001-11-05 15:21 UTC
From: bonseb at free dot fr Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.0.6 OS: Windows NT4 SP6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bonseb at free dot fr
New email:
PHP Version: OS:

 

 [2001-11-05 09:10 UTC] bonseb at free dot fr
[Might be related to bug #11213]

Using :
NT4 SP6
Apache 1.3.20
PHP 4.0.6
Zend Optimizer 1.1 (bug reproduced without also)


I have a quite short PHP page needing to log something, and then switch to another PHP page.

I use the following PHP code :

error_log ($message, 0);
header("Location: new-location.php");

I then get the following error message :
Cannot add header information - headers already sent

If I remove the call to error_log, the problem disappears, but I won't get the event logged :( Thus, error_log must be 'the one' producing the unexpected output.

If I swap the two calls, (header first, then error_log), I'll get to new-location.php, but nothing will get logged :(

If I specify a filename in the call to error_log, and leave it in second position (see following example), it works fine (except I don't automatically get the date and IP address of client like I used to get in Apache's log).

error_log ($message, 3, 'd:/program files/apache group/apache/logs/error.log');


Here is my PHP configuration regarding logging functions :

error_reporting  =  E_ALL & ~E_NOTICE
display_errors = On
display_startup_errors = Off
log_errors = On


Let's add another strange behaviour. If I add the following line in php.ini :
error_log = d:/program files/apache group/apache/logs/error.log
and execute again the first example (error_log with 2 args and then header), it works fine :)

Any clues ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-05 09:55 UTC] bonseb at free dot fr
Pressed submit twice by error :(
Valid bug is #13933
 [2001-11-05 15:21 UTC] jeroen@php.net
Submitted twice -> Bogus
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Sep 15 16:01:27 2019 UTC