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 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: 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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 20:01:28 2024 UTC