#45887 [Opn]: setcookie function set value as 'deleted'

From: Date: Fri, 22 Aug 2008 06:42:12 +0000
Subject: #45887 [Opn]: setcookie function set value as 'deleted'
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1117@lists.php.net to get a copy of this message
 ID:               45887
 Updated by:       jani@php.net
 Reported By:      loganathan dot rs at gmail dot com
 Status:           Open
-Bug Type:         HTTP related
+Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

Note from the code explaining the reason:

/*
* MSIE doesn't delete a cookie when you set it to a null value
* so in order to force cookies to be deleted, even on MSIE, we
* pick an expiry date 1 year and 1 second in the past
*/

And this has been like this since PHP 4..if not even PHP 3.
Might be better to document it finally -> reclassified as docu problem.


Previous Comments:
------------------------------------------------------------------------

[2008-08-22 01:17:37] loganathan dot rs at gmail dot com

Description:
------------
setcookie funciton set value as 'deleted'

setcookie( 'delete_me', '', time() - 1000, '/', '',
'' );

The setcookie function will silently change the '' cookie value to
'deleted' and override your expiry time to time() - 1 year.

I only noticed this when the computer I was testing on had it's date
set incorrectly to the > 1 year in the past.  The computer connects to
the server which has it's date correctly set and thus the cookie on the
client doesn't delete but stores the value "deleted" instead.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45887&edit=1



Thread (2 messages)

« previous php.doc.bugs (#1117) next »