mirror of
https://github.com/itflow-org/itflow
synced 2026-08-17 13:05:12 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
@@ -261,7 +261,7 @@ class Response
|
||||
}
|
||||
|
||||
// Fix Content-Type
|
||||
$charset = $this->charset ?: 'UTF-8';
|
||||
$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')) {
|
||||
@@ -317,6 +317,12 @@ class Response
|
||||
{
|
||||
// headers have already been sent by the developer
|
||||
if (headers_sent()) {
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||
$statusCode ??= $this->statusCode;
|
||||
trigger_deprecation('symfony/http-foundation', '7.4', 'Trying to use "%s::sendHeaders()" after headers have already been sent is deprecated and will throw a PHP warning in 8.0. Use a "StreamedResponse" instead.', static::class);
|
||||
// header(\sprintf('HTTP/%s %s %s', $this->version, $statusCode, $this->statusText), true, $statusCode);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -539,7 +545,7 @@ class Response
|
||||
*/
|
||||
public function isCacheable(): bool
|
||||
{
|
||||
if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) {
|
||||
if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410], true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1248,7 +1254,7 @@ class Response
|
||||
*/
|
||||
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'));
|
||||
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308], true) && (null === $location ?: $location == $this->headers->get('Location'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1258,7 +1264,7 @@ class Response
|
||||
*/
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return \in_array($this->statusCode, [204, 304]);
|
||||
return \in_array($this->statusCode, [204, 304], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user