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
 [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: Sat Dec 21 11:01:30 2024 UTC