|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46639 setcookie with past date fails to delete cookie if path not set
Submitted: 2008-11-21 15:20 UTC Modified: 2008-11-21 23:10 UTC
From: simon at incarnis dot com Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.2.6 OS: Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 37 = ?
Subscribe to this entry?

 [2008-11-21 15:20 UTC] simon at incarnis dot com
Cookie is created with an 8 hour expiry time, supplying only the name, value and expire parameters.

Attempt to remove cookie using setcookie with the same name, a null value and an expire parameter of -1 hours.

Cookie not removed.

Supplying the (supposedly optional) path parameter set to "/" successfully removes the cookie.

Reproduce code:
setcookie("user", $_SESSION[user], mktime()+(60*60*8));  



Expected result:
Cookie should not exist.

Actual result:
Cookie does exist. Add a path parameter of "/" to the removal call and the cookie is removed.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-21 15:53 UTC]
This is just how it works. No bug here.
 [2008-11-21 23:10 UTC] simon at incarnis dot com
Is this documented anywhere?
And isn't it kind of strange to call the parameter optional if it isn't?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 05:01:28 2024 UTC