Cphalcon: Phalcon\Http\Cookie->delete() not working when session.cookie_domain is set

Created on 12 Apr 2014  路  6Comments  路  Source: phalcon/cphalcon

I'm using cookies that should be valid for subdomain and therefore set

session.cookie_domain = .mydomain.com

when I call Phalcon\Http\Cookie->delete() the cookies don't get deleted.

$this->cookies->get('MyCookie')->delete();

I've had to result to this php code to have them deleted:

setcookie('MyCookie', null, -1, '/', ini_get('session.cookie_domain'));

I'm using v1.3.1

Most helpful comment

Alternative way to delete cookie, just set cookie with negative time. Browsers know what to do. BTW this is what phalcon probably do under.

$this->cookies->set('remember', 'remember me', time() - 86400);

All 6 comments

same to me, best way delete cookie in phalcon ?

Alternative way to delete cookie, just set cookie with negative time. Browsers know what to do. BTW this is what phalcon probably do under.

$this->cookies->set('remember', 'remember me', time() - 86400);

My auth system login/logout was working prior to me setting domain and httponly.
The only way to get the cookie to delete was to set negative expire time.
thanks @j3l3v

Needs fixing

Any update?

@addinm The 1.3.x branch is not longer supported. Could you please try 3.2.x.

Closing in favor of #13052.

Was this page helpful?
0 / 5 - 0 ratings