#46639 [Bgs]: setcookie with past date fails to delete cookie if path not set

From: Date: Fri, 21 Nov 2008 23:10:54 +0000
Subject: #46639 [Bgs]: setcookie with past date fails to delete cookie if path not set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131196@lists.php.net to get a copy of this message
ID: 46639 User updated by: simon at incarnis dot com Reported By: simon at incarnis dot com Status: Bogus Bug Type: *Web Server problem Operating System: Solaris 10 PHP Version: 5.2.6 New Comment: Is this documented anywhere? And isn't it kind of strange to call the parameter optional if it isn't? Previous Comments: ------------------------------------------------------------------------ [2008-11-21 15:53:00] jani@php.net This is just how it works. No bug here. ------------------------------------------------------------------------ [2008-11-21 15:20:59] simon at incarnis dot com Description: ------------ 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)); ... ... setcookie("user",NULL,mktime()-3600); 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46639&edit=1

« previous php.bugs (#131196) next »