update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
22
pfosten/vendor/symfony/http-foundation/Cookie.php
vendored
Executable file → Normal file
22
pfosten/vendor/symfony/http-foundation/Cookie.php
vendored
Executable file → Normal file
|
|
@ -46,7 +46,7 @@ class Cookie
|
|||
'path' => '/',
|
||||
'domain' => null,
|
||||
'secure' => false,
|
||||
'httponly' => true,
|
||||
'httponly' => false,
|
||||
'raw' => !$decode,
|
||||
'samesite' => null,
|
||||
);
|
||||
|
|
@ -81,8 +81,6 @@ class Cookie
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The name of the cookie
|
||||
* @param string|null $value The value of the cookie
|
||||
* @param int|string|\DateTimeInterface $expire The time the cookie expires
|
||||
|
|
@ -126,7 +124,11 @@ class Cookie
|
|||
$this->httpOnly = (bool) $httpOnly;
|
||||
$this->raw = (bool) $raw;
|
||||
|
||||
if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) {
|
||||
if (null !== $sameSite) {
|
||||
$sameSite = strtolower($sameSite);
|
||||
}
|
||||
|
||||
if (!\in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) {
|
||||
throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.');
|
||||
}
|
||||
|
||||
|
|
@ -143,12 +145,12 @@ class Cookie
|
|||
$str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'=';
|
||||
|
||||
if ('' === (string) $this->getValue()) {
|
||||
$str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001';
|
||||
$str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0';
|
||||
} else {
|
||||
$str .= $this->isRaw() ? $this->getValue() : urlencode($this->getValue());
|
||||
$str .= $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue());
|
||||
|
||||
if (0 !== $this->getExpiresTime()) {
|
||||
$str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; max-age='.$this->getMaxAge();
|
||||
$str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; Max-Age='.$this->getMaxAge();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +224,9 @@ class Cookie
|
|||
*/
|
||||
public function getMaxAge()
|
||||
{
|
||||
return 0 !== $this->expire ? $this->expire - time() : 0;
|
||||
$maxAge = $this->expire - time();
|
||||
|
||||
return 0 >= $maxAge ? 0 : $maxAge;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -262,7 +266,7 @@ class Cookie
|
|||
*/
|
||||
public function isCleared()
|
||||
{
|
||||
return $this->expire < time();
|
||||
return 0 !== $this->expire && $this->expire < time();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue