Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow commas in cookie values #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Cookie/RequestCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
final class RequestCookie implements \Stringable
{
private const NAME_REGEX = /** @lang RegExp */ '(^[^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]*+$)';
private const VALUE_REGEX = /** @lang RegExp */ '(^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]*+$)';
private const VALUE_REGEX = /** @lang RegExp */ '(^[\x21\x23-\x3A\x3C-\x5B\x5D-\x7E]*+$)';

/**
* Parses the cookies from a 'cookie' header.
Expand Down
2 changes: 1 addition & 1 deletion src/Cookie/ResponseCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
final class ResponseCookie implements \Stringable
{
private const NAME_REGEX = /** @lang RegExp */ '(^[^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]*+$)';
private const VALUE_REGEX = /** @lang RegExp */ '(^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]*+$)';
private const VALUE_REGEX = /** @lang RegExp */ '(^[\x21\x23-\x3A\x3C-\x5B\x5D-\x7E]*+$)';

private static array $dateFormats = [
'D, d M Y H:i:s T',
Expand Down
2 changes: 1 addition & 1 deletion test/Cookie/RequestCookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testParsing()
$this->assertEquals([new RequestCookie("a", "1"), new RequestCookie("b", "2")], RequestCookie::fromHeader("a=1; b=2"));
$this->assertEquals([new RequestCookie("a", "1"), new RequestCookie("b", "2")], RequestCookie::fromHeader("a=1 ;b=2"));
$this->assertEquals([new RequestCookie("a", "1"), new RequestCookie("b", "-2")], RequestCookie::fromHeader("a=1; b = -2"));
$this->assertEquals([], RequestCookie::fromHeader("a=1; b=2,2"));
$this->assertEquals([new RequestCookie("a", "1"), new RequestCookie("b", "2,2")], RequestCookie::fromHeader("a=1; b=2,2"));
$this->assertEquals([], RequestCookie::fromHeader("a=1; b=2 2"));
$this->assertEquals([], RequestCookie::fromHeader("a=1; b"));
}
Expand Down