|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
28 + 7 = ?
Subscribe to this entry?

 [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: Fri Jul 30 08:01:24 2021 UTC