Skip to content

Cookie SameSite in lowercase #23585

Closed
Closed
@mxkxf

Description

@mxkxf
Q A
Bug report? yes
Feature request? no
BC Break report? maybe
RFC? no
Symfony version latest

I am creating a Laravel wrapper around @aidantwoods SecureHeaders package and am experiencing an issue with using Symfony\Component\HttpFoundation\ResponseHeaderBag::set() with a cookie.

The cookie I am trying to set has the attribute SameSite=Lax which comes from Aidan's package, which I then attempt to set but get the following InvalidArgumentException:

The "sameSite" parameter value is not valid.

This is because the check (

if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) {
) references the Cookie::SAMESITE_LAX and Cookie::SAMESITE_STRICT constants which are both lowercase.

My suggestion would be to change this check to match case insensitively, but not sure how much of a breaking change this would be.

Would gladly submit a pull request for this!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions