Aggiornato Composer
This commit is contained in:
25
vendor/symfony/http-foundation/Response.php
vendored
25
vendor/symfony/http-foundation/Response.php
vendored
@@ -72,7 +72,7 @@ class Response
|
||||
public const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
|
||||
public const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
|
||||
public const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
|
||||
public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
|
||||
public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; // RFC7725
|
||||
public const HTTP_INTERNAL_SERVER_ERROR = 500;
|
||||
public const HTTP_NOT_IMPLEMENTED = 501;
|
||||
public const HTTP_BAD_GATEWAY = 502;
|
||||
@@ -298,7 +298,7 @@ class Response
|
||||
$charset = $this->charset ?: 'UTF-8';
|
||||
if (!$headers->has('Content-Type')) {
|
||||
$headers->set('Content-Type', 'text/html; charset='.$charset);
|
||||
} elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
|
||||
} elseif (0 === stripos($headers->get('Content-Type') ?? '', 'text/') && false === stripos($headers->get('Content-Type') ?? '', 'charset')) {
|
||||
// add the charset
|
||||
$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
|
||||
}
|
||||
@@ -399,6 +399,7 @@ class Response
|
||||
litespeed_finish_request();
|
||||
} elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
|
||||
static::closeOutputBuffers(0, true);
|
||||
flush();
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -462,7 +463,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setStatusCode(int $code, string $text = null): object
|
||||
public function setStatusCode(int $code, ?string $text = null): object
|
||||
{
|
||||
$this->statusCode = $code;
|
||||
if ($this->isInvalid()) {
|
||||
@@ -736,7 +737,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setExpires(\DateTimeInterface $date = null): object
|
||||
public function setExpires(?\DateTimeInterface $date = null): object
|
||||
{
|
||||
if (null === $date) {
|
||||
$this->headers->remove('Expires');
|
||||
@@ -773,8 +774,10 @@ class Response
|
||||
return (int) $this->headers->getCacheControlDirective('max-age');
|
||||
}
|
||||
|
||||
if (null !== $this->getExpires()) {
|
||||
return (int) $this->getExpires()->format('U') - (int) $this->getDate()->format('U');
|
||||
if (null !== $expires = $this->getExpires()) {
|
||||
$maxAge = (int) $expires->format('U') - (int) $this->getDate()->format('U');
|
||||
|
||||
return max($maxAge, 0);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -818,7 +821,7 @@ class Response
|
||||
*
|
||||
* It returns null when no freshness information is present in the response.
|
||||
*
|
||||
* When the responses TTL is <= 0, the response may not be served from cache without first
|
||||
* When the response's TTL is 0, the response may not be served from cache without first
|
||||
* revalidating with the origin.
|
||||
*
|
||||
* @final
|
||||
@@ -827,7 +830,7 @@ class Response
|
||||
{
|
||||
$maxAge = $this->getMaxAge();
|
||||
|
||||
return null !== $maxAge ? $maxAge - $this->getAge() : null;
|
||||
return null !== $maxAge ? max($maxAge - $this->getAge(), 0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -883,7 +886,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setLastModified(\DateTimeInterface $date = null): object
|
||||
public function setLastModified(?\DateTimeInterface $date = null): object
|
||||
{
|
||||
if (null === $date) {
|
||||
$this->headers->remove('Last-Modified');
|
||||
@@ -921,7 +924,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setEtag(string $etag = null, bool $weak = false): object
|
||||
public function setEtag(?string $etag = null, bool $weak = false): object
|
||||
{
|
||||
if (null === $etag) {
|
||||
$this->headers->remove('Etag');
|
||||
@@ -1214,7 +1217,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function isRedirect(string $location = null): bool
|
||||
public function isRedirect(?string $location = null): bool
|
||||
{
|
||||
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user