Skip to content

Not possible to delete a cookie with the same name from multiple domains #139

@renekliment

Description

@renekliment
  • bug report? yes
  • feature request? no
  • version: 2.4.5, the code in master looks the same

Description

Due to Response::setCookie() calling Helpers::removeDuplicateCookies(), it is not possible to delete a cookie with the same name from multiple domains.

Came upon it today when I found out there may be accidental cookies for subdomains in our project instead of one cookie for our root domain. Tried to delete all the cookies in the subdomains using Response, but failed.

A naive solution would be to put the Helpers::removeDuplicateCookies() call in a condition, which could be controlled by a parameter of Response::setCookie(), the same for Response::deleteCookie(), but these methods can be called from anywhere and even one call w/o the flag to not call the Helpers::removeDuplicateCookies() would break it.
Having this setting as a settable class property would probably work.
Actually I don't know why the Helpers::removeDuplicateCookies() is there, so I cannot really tell if it would make sense.

Steps To Reproduce

$response->deleteCookie('lang', null, 'sub.domain.com');
$response->deleteCookie('lang', null, 'domain.com');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions