php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12481 Cookie cannot be set if there is no output for a page
Submitted: 2001-07-31 05:20 UTC Modified: 2002-06-18 18:38 UTC
From: tcmleung at yahoo dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 4.0.6 OS: Window 2000 and IIS4
Private report: No CVE-ID: None
 [2001-07-31 05:20 UTC] tcmleung at yahoo dot com
Example
Below is code for test1.phtml
<?
	setcookie("cokTest","test cookie",0,"/");
	header("location:test2.phtml");
	
?>
End of test1.phtml
Below is code for test2.phtml
<?
	echo "CokTest : $cokTest";
?>
End of test2.phtml

If I start to run test1.phtml, then the output is as the following:

CokTest :

It means that $cokTest cannot be set if there is no output in test1.phtml.
There is no problem in Linux-apache platform.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-11 12:23 UTC] sander@php.net
Dupe of #9802
 [2002-06-18 18:38 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-10-17 16:00 UTC] dhemelings at hotmail dot com
This bug isn't fixed, I installed PHP 4.2.3 on a Win 2000 Server box and experience the same problem. When I try it on my Win XP machine it works.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 09 12:05:50 2023 UTC