php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28923 session_start() problem after flush()
Submitted: 2004-06-25 16:34 UTC Modified: 2004-06-29 17:54 UTC
From: joula at sztaki dot hu Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.7 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joula at sztaki dot hu
New email:
PHP Version: OS:

 

 [2004-06-25 16:34 UTC] joula at sztaki dot hu
Description:
------------
Hello,

There is a problem with session_start() when I call it after flush().

Thanks.

Reproduce code:
---------------
<?
flush();
session_start();
echo "here";
?>

Expected result:
----------------
Do not get warning.

Actual result:
--------------
Warning: session_start(): Cannot send session cookie - headers already sent in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 17:54 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

when you call flush() even if nothing was flushed PHP sets 
a flag indicating that body of the message was sent and no 
more headers can be sent. This is why you get an error from 
session_start() which attempts to send http headers. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 11:01:36 2025 UTC