I have two simple functions to set and clear cookie.
private function _setCookie($value = null) {
$value = $value === null ? $this->getRandomId() : $value;
setcookie($this->getName(), $value, time()+10800, '/');
}
private function _clearCookie() {
setcookie($this->getName(), '', time()-10800, '/');
}
There is a page when accessed starts session and create a cookie as desired. When redirect call happens from different server to my page , delete cookie function calls internally above _clearCookie funtion.I checked setcookie returns true and I also tried to unset cookie in same method but cookie is still available when I reload page. I still can find that cookie in browser as well as firebug and print_r($_COOKIE)
Also I changed expire time to time()-(3600*24) as mentioned is some others threads but no change in my case. What am I missing here?
so when I mentioned ‘redirect call happens from different server to my page’ I was trying to mention it as back channel call. And being a back channel call, browser cookies were not getting identified I suppose and that is the main reason even if setcookie returns me true, actual cookie deletion from browser would never happen in such cases.