Cookie value 'deleted'

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.*

unset( Yii::app()->request->cookies[‘name’] );


setcookie( ‘name’, Null, 0, ‘/’, ‘’, false, false );

Not delete cookie, but value will be ‘deleted’

isset( Yii::app()->request->cookies[‘name’] ) returned true.


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().