#28613 [Opn->Bgs]: Output sent before header or setcookie

From: Date: Thu, 03 Jun 2004 07:36:36 +0000
Subject: #28613 [Opn->Bgs]: Output sent before header or setcookie
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969361146@lists.php.net to get a copy of this message
ID: 28613 Updated by: vrana@php.net Reported By: jsgoupil at lookstrike dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: WinXP PHP Version: 5.0.0RC2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-06-02 23:24:57] jsgoupil at lookstrike dot com Description: ------------ 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 header("Location: http://www.lookstrike.com"); , 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: --------------- <?php echo "A"; header("Location: http://www.lookstrike.com"); // Going to Website ?> of <?php echo "A"; setcookie("TEST"); // No error ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28613&edit=1

« previous php.doc (#969361146) next »