php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2968 white space in document before setcookie() is called ruins chance to setcookie
Submitted: 1999-12-13 14:19 UTC Modified: 1999-12-13 14:43 UTC
From: sladd at mail dot rit dot edu Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Linux 2.2.13
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: sladd at mail dot rit dot edu
New email:
PHP Version: OS:

 

 [1999-12-13 14:19 UTC] sladd at mail dot rit dot edu
I don't think this is the way it is supposed to be.

If there is white space before a setcookie() call, even if no text is sent, setcookie fails because it was thinking that text has been sent.

More exactly, if we have this (the dashes indicate begining of file)

----------------------------------------
<?php include("include.inc"); ?>

<?php setcookie("test", "test", time()+60); ?>
-----------------------------------------

will FAIL, even though inside my include.inc I have no text being printed out.  The following DOES work.

--------------------------------------
<?php include("include.inc"); ?>
<?php setcookie("test", "test", time()+60); ?>
-------------------------------------

Notice how there is no space after the include.  The whitespace outside of the <?php ?> tags seems to matter.  This is not clearly defined in the documentation, and I believe it's a bug.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-13 14:43 UTC] joey at cvs dot php dot net
This /IS/ the way it is supposed to be. Please see:
http://www.php.net/manual/function.setcookie.php3

In short, /ANY/ whitespace is considered "text to be sent".

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 23:01:32 2024 UTC