comparison vendor/symfony/http-foundation/Cookie.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
39 * 39 *
40 * @return static 40 * @return static
41 */ 41 */
42 public static function fromString($cookie, $decode = false) 42 public static function fromString($cookie, $decode = false)
43 { 43 {
44 $data = array( 44 $data = [
45 'expires' => 0, 45 'expires' => 0,
46 'path' => '/', 46 'path' => '/',
47 'domain' => null, 47 'domain' => null,
48 'secure' => false, 48 'secure' => false,
49 'httponly' => false, 49 'httponly' => false,
50 'raw' => !$decode, 50 'raw' => !$decode,
51 'samesite' => null, 51 'samesite' => null,
52 ); 52 ];
53 foreach (explode(';', $cookie) as $part) { 53 foreach (explode(';', $cookie) as $part) {
54 if (false === strpos($part, '=')) { 54 if (false === strpos($part, '=')) {
55 $key = trim($part); 55 $key = trim($part);
56 $value = true; 56 $value = true;
57 } else { 57 } else {
126 126
127 if (null !== $sameSite) { 127 if (null !== $sameSite) {
128 $sameSite = strtolower($sameSite); 128 $sameSite = strtolower($sameSite);
129 } 129 }
130 130
131 if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { 131 if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, null], true)) {
132 throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.'); 132 throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.');
133 } 133 }
134 134
135 $this->sameSite = $sameSite; 135 $this->sameSite = $sameSite;
136 } 136 }
264 * 264 *
265 * @return bool 265 * @return bool
266 */ 266 */
267 public function isCleared() 267 public function isCleared()
268 { 268 {
269 return $this->expire < time(); 269 return 0 !== $this->expire && $this->expire < time();
270 } 270 }
271 271
272 /** 272 /**
273 * Checks if the cookie value should be sent with no url encoding. 273 * Checks if the cookie value should be sent with no url encoding.
274 * 274 *