|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #28613 Output sent before header or setcookie
Submitted: 2004-06-02 23:24 UTC Modified: 2004-06-03 09:36 UTC
From: jsgoupil at lookstrike dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.0.0RC2 OS: WinXP
Private report: No CVE-ID: None
 [2004-06-02 23:24 UTC] jsgoupil at lookstrike dot com
In the documentation : "Remember that header() must be called before any actual output is sent..."
We can find the same in setcookie() function.

In PHP5, when we use
, the function doen't care if we sent something before.

If other function exists like that, perhaps it will do the same thing...

php.ini file : 
display_error = On
error_reporting = E_ALL

I don't know if you have to clarify the docs or if it is a function bug...

Reproduce code:
echo "A";
header("Location:"); // Going to Website


echo "A";
setcookie("TEST"); // No error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-03 09:36 UTC]
It works for you because you have output_buffering turned on. It's explained well in the documentation:

In PHP 4, you can use output buffering to get around this problem, with the overhead of all of your output to the browser being buffered in the server until you send it.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 15:03:36 2021 UTC