|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-12-17 21:36 UTC] smclean at scoreinfo dot tv
The behavoir of the setcookie function changed in 4.1.0 even though no such change was documented in the changelog. This had the effect of disabling an application of mine until I figured out what happened.
In PHP <4.1.0, the code:
setcookie("cookiename","");
would delete the cookie 'cookiename'.
In PHP 4.1.0, this function created a cookie with a null value named cookiename.
I know this is a rather silly change, and you wouldn't expect someone to ever specify a blank value in the second argument, but it did cause a short downtime in our website software.
I posted this on the setcookie() manual page but it was rejected on grounds that it was more of a bug report than anything, so I thought I'd post it here.
Thanks
Sean
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
This hasn't changed. setcookie('name','') doesn't remove the cookie, and it never did. To remove a cookie, use setcookie with a expire-date in the past, i.e. setcookie('name','', time()-10000).In 4.1.1 setcookie("cookiename") don't work for me to removing a cookie. It sets a cookie with empty value as if I did setcookie("cookiename", ""); In 4.0.x setcookie("cookiename"); was enough.