Skip to content

Commit

Permalink
Merge pull request #1999 from curtisdf/malformed-domain
Browse files Browse the repository at this point in the history
Error with malformed domain that contains a "/" character
  • Loading branch information
sagikazarmark committed Mar 26, 2018
2 parents 8ffb1d2 + e6f837a commit 6da464c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cookie/SetCookie.php
Expand Up @@ -348,7 +348,7 @@ public function matchesDomain($domain)
return false;
}

return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain);
return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/Cookie/SetCookieTest.php
Expand Up @@ -116,6 +116,9 @@ public function testMatchesDomain()

$cookie->setDomain('.local');
$this->assertTrue($cookie->matchesDomain('example.local'));

$cookie->setDomain('example.com/'); // malformed domain
$this->assertFalse($cookie->matchesDomain('example.com'));
}

public function pathMatchProvider()
Expand Down

0 comments on commit 6da464c

Please sign in to comment.