|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31652 setcookie not working in Gecko browsers
Submitted: 2005-01-22 07:52 UTC Modified: 2005-02-03 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: richkerr at disabilitysoft dot com Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.3.10 OS: Win98
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-01-22 07:52 UTC] richkerr at disabilitysoft dot com
Followed basic instruction in php documentation for setting cookies.  Gave in to standards compliant browsers only, but with code below, cookies work in  IE6.0 and Opera but not in Netscape 7.1 or Firefox 1.0.

Adding the path, domain, and secure using code identical to Manual causes it to fail in IE as well.  Would be nice if this basic function would work for all standards complaint browsers?

Page uses ob_start(), session_start() and no header output before call to SetMyCookie.

Server is Apache 1.3.33 (Unix).

Reproduce code:
Function SetMyCookie($db, $login, $pwd){
if ($db == ""  and $login == "" and $pwd == ""){
setcookie("login", "", time() - 3600);//fails in netscape
setcookie("password", "", time() - 3600);
setcookie("db", "", time() - 3600);
setcookie ("login", $login, time() + 60*60*24*1800);
setcookie ("password", $pwd, time() + 60*60*24*1800);
setcookie ("db", $db, time() + 60*60*24*1800);


Expected result:
Three cookies are set with name login, password, db and values $db, $login, and $pwd set to expire in 1800 days.  Cookies visible in the current domain folder.

If SetMyCookie is called with empty params, then cookies, with name login, password, and db are deleted from current domain folder.

Actual result:
Cookies not set or deleted in Gecko based browsers.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-22 14:20 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

Your script is not complete.

 [2005-02-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 16:01:29 2024 UTC