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

From: Date: Wed, 05 Nov 2008 09:54:51 +0000
Subject: #45887 [Opn->Csd]: setcookie function set value as 'deleted'
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1340@lists.php.net to get a copy of this message
 ID:               45887
 Updated by:       vrana@php.net
 Reported By:      loganathan dot rs at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"This is internally achieved by setting value to 'deleted' and
expiration time to one year in past."


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

[2008-08-22 06:42:11] jani@php.net

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.

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

[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 (#1340) next »