php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8382 re-sending http header due to session_start()
Submitted: 2000-12-22 16:38 UTC Modified: 2000-12-22 18:00 UTC
From: jmessner at neo dot rr dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.2 OS: Mandrake 7.1
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: jmessner at neo dot rr dot com
New email:
PHP Version: OS:

 

 [2000-12-22 16:38 UTC] jmessner at neo dot rr dot com
This related to bug #7877, which was said not to be a bug, and that you must session_start() before any html gets sent so that the cookie gets sent before the html header.  Otherwise, calling session_start() gives the error messages stated in #7877.

At least in 4.0.2, I have found that you cannot even have so much as one blank line in your php file before your <?php tag, or else the initial header gets sent and start_session() fails.  You MUST have <?php as the absolute very first bytes of your file.

This should either be fixed, or at least well documented.  The docs don't say anything about the importance of start_session() being called immediately, nor do they say anywhere that if you have any blank lines before your <?php tag that it will then be too late to start a session.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-22 18:00 UTC] sas@php.net
If you want to send any content before using functions which manipulate the HTTP header, I suggest enabling output buffering. This is not a bug and hence this report gets closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC