Lion
(Lion__)
July 24, 2011, 7:44pm
1
When “setcookie” is passed an empty value (ie, ‘’), it changes the value to the string “deleted” and sets the date to exactly one year and one second in the past, ignoring the expiration parameter.*
Cookies must be deleted with the same parameters as they were set with. If the value argument is an empty string, or FALSE, and all other arguments match a previous call to setcookie, then the cookie with the specified name will be deleted from the remote client. This is internally achieved by setting value to ‘deleted’ and expiration time to one year in past.
unset( Yii::app()->request->cookies[‘name’] );
or
setcookie( ‘name’, Null, 0, ‘/’, ‘’, false, false );
Not delete cookie, but value will be ‘deleted’
isset( Yii::app()->request->cookies[‘name’] ) returned true.
marcovtwout
(Marco van 't Wout)
December 28, 2011, 8:44am
3
This is expected behavior, since internally PHP’s set_cookie() is used.
I quote from the PHP page:
Because it is hidden behind a Yii layer, it might be desireable to let Yii core handle the conversion to int for boolean values?
On the other hand, if we do that, it might break backwards compatibility, and it doesn’t align anymore with set_cookie().