• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Accessing and modifying cookies in the response object

Affected version
2.0.0 RC1

Jeremy P

Well-known member
Okay, I know this one isn't quite a bug (sorry). I understand if this must be moved to suggestions, but it's a simple change that I had requested a while back during the demo that I think could be useful.

You can get cookies from the request object like so:
$cookies = \XF:app()->request()->getCookies();
However, in the response object it is only possible to set cookies. It would be great if we could get some methods to get and delete cookies there as well. I know you can delete cookies from the client by setting them to false, but I mean to delete them so they aren't sent in the response at all. For example, Symfony's HttpFoundation response object uses a ResponseHeaderBag object for headers, which has both getCookies() and removeCookie() methods.

My use case is that I want to check if a certain cookie is being sent back (late into the request life-cycle), and conditionally remove it or modify it.

It should be about as straight forward as this, I believe:
public function removeCookie($name)

    return $this;

public function cookies()
    return $this->cookies;
I would certainly appreciate if this could be considered.