Is It A Bug For Chttprequest?


I use cookie.jquery.js setup a cookie:

$.cookie('result', my, {'domain': '', 'path': '/'});

when I get value by $_COOKIE[‘result’],but I can not get the key and the value of it.why? Is it a bug for CHttpRequest?

$cookies = $r->getCookies()->getIterator();

$cookies2 = $_COOKIE['result'];

$r = Yii::app()->request;


while ($cookies->valid()){




do you have cookie validation turned on (

if so - maybe your cookie does not pass validation process…

yes,I turn on cookie validation.

so - this is the answer. Cookies created by Yii with cookie validation turned on have some control sum that validates if they were not altered (or maybe it is done different way I am not sure about specific implementation). Your cookie has just plain value so it does not pass the validation process. If you want to use such cookies in Yii way - you have to turn of cookie validation…