Home  |  Linux  | Mysql  | PHP  | XML
From:jani@php.net Date:Fri Aug 22 00:42:12 2008
Subject:#45887 [Opn]: setcookie function set value as 'deleted'
 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

Navigate in group php.doc.bugs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants