diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-10-10 00:28:20 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-10-10 00:28:20 +0100 |
| commit | 1413eee0f149cccf7c528e3673d7569a368e4a9b (patch) | |
| tree | 0f7c151dcd9d1bbc1694e9d0aade1cdae5cc54e2 /vendor/symfony/http-foundation/Cookie.php | |
| parent | 3ecf8b4e3b9edb7773bcf328f4533da4f452929a (diff) | |
| download | webtrees-1413eee0f149cccf7c528e3673d7569a368e4a9b.tar.gz webtrees-1413eee0f149cccf7c528e3673d7569a368e4a9b.tar.bz2 webtrees-1413eee0f149cccf7c528e3673d7569a368e4a9b.zip | |
Update vendor dependencies
Diffstat (limited to 'vendor/symfony/http-foundation/Cookie.php')
| -rw-r--r-- | vendor/symfony/http-foundation/Cookie.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php index e6b8b798f2..1e22c745a0 100644 --- a/vendor/symfony/http-foundation/Cookie.php +++ b/vendor/symfony/http-foundation/Cookie.php @@ -18,6 +18,10 @@ namespace Symfony\Component\HttpFoundation; */ class Cookie { + const SAMESITE_NONE = 'none'; + const SAMESITE_LAX = 'lax'; + const SAMESITE_STRICT = 'strict'; + protected $name; protected $value; protected $domain; @@ -25,13 +29,14 @@ class Cookie protected $path; protected $secure; protected $httpOnly; + private $raw; private $sameSite; private $secureDefault = false; - const SAMESITE_NONE = 'none'; - const SAMESITE_LAX = 'lax'; - const SAMESITE_STRICT = 'strict'; + private static $reservedCharsList = "=,; \t\r\n\v\f"; + private static $reservedCharsFrom = ['=', ',', ';', ' ', "\t", "\r", "\n", "\v", "\f"]; + private static $reservedCharsTo = ['%3D', '%2C', '%3B', '%20', '%09', '%0D', '%0A', '%0B', '%0C']; /** * Creates cookie from raw header string. @@ -93,7 +98,7 @@ class Cookie } // from PHP source code - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { + if ($raw && false !== strpbrk($name, self::$reservedCharsList)) { throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); } @@ -141,7 +146,13 @@ class Cookie */ public function __toString() { - $str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'='; + if ($this->isRaw()) { + $str = $this->getName(); + } else { + $str = str_replace(self::$reservedCharsFrom, self::$reservedCharsTo, $this->getName()); + } + + $str .= '='; if ('' === (string) $this->getValue()) { $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0'; |
