We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Delete cookie with $this->cookies->delete("cookie_name")

Hi, again from me :D.

I have one question related to cookies and deleting them. I trying to delete cookie with $this->cookies->delete('cookie_name') or $this->cookies->get('cookie_name') but this is impossible. I made it work by just changing cookie expiration date in the past. Yet why the methods do not work? I have seen in the documentation that these methods do not delete from the global $_COOKIE, then from where they delete it?



10.1k
Accepted
answer

If you're on Phalcon 4 it could be related to this bug: https://github.com/phalcon/cphalcon/issues/14667 We will release 4.0.1 today that should fix this.

This is great. I love Phalcon!

Thanks Ruud!