Set cookies issue


I am experiencing cookie corruption.

Setting cokkies as following:

$cookieName = '_my_cookie';

$cookieValue = 'b1a6a692421175ae.1412089317.';

$cookie = new CHttpCookie($cookieName, $cookieValue);

Yii::app()->request->cookies[$cookieName] = $cookie;

But in response header I got:

_my_cookie=f62715c8e0b4293790384b9544c9c310ce389b08s%3A35%3A%22b1a6a692421175ae.1412089317.; expires=Thu, 29-Sep-2016 15:01:57 GMT; path=/;

What may be a reason for cookie corruption?

I don’t understand how your code works)) I think you should be get exception.

Cookie must be set like this:

Yii::app()->request->cookies[$cookieName] = new CHttpCookie($cookieName, $cookieValue);

Detailed description see:

Thanks the code was exactly as you mentioned.