php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32769 Session cookies with non-default lifetimes not expiring in Firefox
Submitted: 2005-04-19 16:42 UTC Modified: 2005-04-19 22:41 UTC
From: oc106 at york dot ac dot uk Assigned:
Status: Not a bug Package: Session related
PHP Version: 5CVS-2005-04-19 (dev) OS: Win XP Pro SP2
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: oc106 at york dot ac dot uk
New email:
PHP Version: OS:

 

 [2005-04-19 16:42 UTC] oc106 at york dot ac dot uk
Description:
------------
If session lifetime is set to other than 0 (i.e. other than expire at end of session), then this is not honoured in Firefox (1.0.2), but is in other browsers (tested in IE6, Opera 7.54, Mozilla 1.8)

Cookies set with setcookie() with non-default lifetimes expire fine.

However, manually setting a cookie with the session cookie name (i.e. setcookie("PHPSESSID", ...)) with a lifetime causes the same problems as using the session functions.


Running on Apache 2.0.52, and using original php.ini-dist settings. (Also tested in PHP 5.0.4 release)

Reproduce code:
---------------
<?php
/*
 * Note: this code assumes server time is the same as user
 * time (e.g. run from localhost).
 */

session_set_cookie_params(30);
session_start();

setcookie("test", "foo", time() + 30, "/");

/*
 * uncommenting this line and commenting out the session
 * functions produces the same problem.
 */
// setcookie("PHPSESSID", "foo", time() + 30, "/");

print_r($_COOKIE);
?>




Expected result:
----------------
In Firefox, after loading the page produced by the above code, viewing Tools->Options->Privacy->View Cookies, the list shows two cookies for the page, "test" and "PHPSESSID". They should both be shown to expire 30 seconds after the page was loaded (this behaviour can be observed in Mozilla via Tools->Cookie Manager->Manage Stored Cookies).

If the page is refreshed after more than 30 seconds, the print_r() statement should show an empty array.

Actual result:
--------------
"test" is shown as expiring 30 seconds after the page was loaded, however "PHPSESSID" is shown as expiring "at end of session".

When refreshed after more than 30 seconds, the print_r() statement still shows the existence of $_COOKIE["PHPSESSID"]. This only occurs in Firefox (out of the browsers listed above).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-19 22:41 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 09:01:33 2024 UTC