Hey Guys,
I am not sure what I am doing wrong here. I am just trying to update the value of an existing Cookie, but no matter what I do, it won’t update the Cookie. Would be great if someone could give me a hand here.
This Code is what I tried yet(in all browsers):
First checking if Cookie exists, I just checked in the browser with a var_dump($cookie):
object(CHttpCookie)#114 (9) { ["name"]=> string(35) "ufc" ["value"]=> string(1) "1" ["domain"]=> string(0) "" ["expire"]=> int(0) ["path"]=> string(1) "/" ["secure"]=> bool(false) ["httpOnly"]=> bool(false) ["_e":"CComponent":private]=> NULL ["_m":"CComponent":private]=> NULL }
also Checking Firefox & Opera and the Cookie is in place. What I am really wondering about is that expire says 0!! While Firefox Cookie Manager says otherwise (time()+60*60 or +1 hour)
$old_cookie = Yii::app()->request->cookies['ufc'];
$old_cookie->value += 1;
Yii::app()->request->cookies['ufc'] = $old_cookie;
What I am intending to do is to update the old Cookie with a new value, I don’t even want to touch the expiration date once it’s set.
Tried everything now, even restarting Computer/reinstalling Browsers. Doesn’t matter, it just won’t update the value.
I’d be really thankful for any help.
Cheers,
Seb