N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)

* Update Symfony lib to version ~6.4.0
* Update code missing return type
* Add an iTop general configuration entry to store application secret (Symfony mandatory parameter)
* Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -24,6 +24,10 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
abstract class AbstractSurrogate implements SurrogateInterface
{
protected $contentTypes;
/**
* @deprecated since Symfony 6.3
*/
protected $phpEscapeMap = [
['<?', '<%', '<s', '<S'],
['<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'],
@@ -40,18 +44,13 @@ abstract class AbstractSurrogate implements SurrogateInterface
/**
* Returns a new cache strategy instance.
*
* @return ResponseCacheStrategyInterface
*/
public function createCacheStrategy()
public function createCacheStrategy(): ResponseCacheStrategyInterface
{
return new ResponseCacheStrategy();
}
/**
* {@inheritdoc}
*/
public function hasSurrogateCapability(Request $request)
public function hasSurrogateCapability(Request $request): bool
{
if (null === $value = $request->headers->get('Surrogate-Capability')) {
return false;
@@ -61,7 +60,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
}
/**
* {@inheritdoc}
* @return void
*/
public function addSurrogateCapability(Request $request)
{
@@ -71,10 +70,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
$request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new);
}
/**
* {@inheritdoc}
*/
public function needsParsing(Response $response)
public function needsParsing(Response $response): bool
{
if (!$control = $response->headers->get('Surrogate-Control')) {
return false;
@@ -85,10 +81,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
return (bool) preg_match($pattern, $control);
}
/**
* {@inheritdoc}
*/
public function handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)
public function handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors): string
{
$subRequest = Request::create($uri, Request::METHOD_GET, [], $cache->getRequest()->cookies->all(), [], $cache->getRequest()->server->all());
@@ -115,6 +108,8 @@ abstract class AbstractSurrogate implements SurrogateInterface
/**
* Remove the Surrogate from the Surrogate-Control header.
*
* @return void
*/
protected function removeFromControl(Response $response)
{
@@ -133,4 +128,15 @@ abstract class AbstractSurrogate implements SurrogateInterface
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
}
}
protected static function generateBodyEvalBoundary(): string
{
static $cookie;
$cookie = hash('xxh128', $cookie ?? $cookie = random_bytes(16), true);
$boundary = base64_encode($cookie);
\assert(HttpCache::BODY_EVAL_BOUNDARY_LENGTH === \strlen($boundary));
return $boundary;
}
}