php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #8974 Blank lines in includes cause session errors
Submitted: 2001-01-29 00:42 UTC Modified: 2002-01-06 13:03 UTC
From: samj at faredge dot com dot au Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: samj at faredge dot com dot au
New email:
PHP Version: OS:

 

 [2001-01-29 00:42 UTC] samj at faredge dot com dot au
A PHP script with includes followed by commands which set headers (ie session_start) will generate errors if include file(s) contain blank lines. For example:

<?
  include "includes/functions.inc";
  session_start();
?>

where functions.inc contains leading or trailing blank lines will result in an error like:

Warning: Cannot send session cache limiter - headers already sent

This problem appears to be very common (according to a search on google), and has no doubt frustrated many PHP users.

Unfortunately this behaviour is technically 'correct', although it should probably be fixed anyway.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-06 13:03 UTC] jan@php.net
technically it is an user error. to solve it either eliminate any whitespace or call ob_start() before session_start(). the same thing applies for header(). no bug. bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC