Updates to vendors etc

This commit is contained in:
Chris Hunt
2025-07-11 15:57:48 +01:00
parent d972cbcd0a
commit 8fb6438254
8043 changed files with 248005 additions and 189479 deletions

View File

@@ -37,7 +37,6 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
// Help opcache.preload discover always-needed symbols
@@ -58,13 +57,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
/**
* @var array<string, BundleInterface>
*/
protected $bundles = [];
protected array $bundles = [];
protected $container;
protected $environment;
protected $debug;
protected $booted = false;
protected $startTime;
protected ?ContainerInterface $container = null;
protected bool $booted = false;
protected ?float $startTime = null;
private string $projectDir;
private ?string $warmupDir = null;
@@ -76,23 +73,23 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
private static array $freshCache = [];
public const VERSION = '6.4.3';
public const VERSION_ID = 60403;
public const MAJOR_VERSION = 6;
public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 3;
public const VERSION = '7.3.1';
public const VERSION_ID = 70301;
public const MAJOR_VERSION = 7;
public const MINOR_VERSION = 3;
public const RELEASE_VERSION = 1;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '11/2026';
public const END_OF_LIFE = '11/2027';
public const END_OF_MAINTENANCE = '01/2026';
public const END_OF_LIFE = '01/2026';
public function __construct(string $environment, bool $debug)
{
if (!$this->environment = $environment) {
throw new \InvalidArgumentException(sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
public function __construct(
protected string $environment,
protected bool $debug,
) {
if (!$environment) {
throw new \InvalidArgumentException(\sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
}
$this->debug = $debug;
}
public function __clone()
@@ -103,10 +100,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$this->resetServices = false;
}
/**
* @return void
*/
public function boot()
public function boot(): void
{
if (true === $this->booted) {
if (!$this->requestStackSize && $this->resetServices) {
@@ -134,20 +128,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$this->booted = true;
}
/**
* @return void
*/
public function reboot(?string $warmupDir)
public function reboot(?string $warmupDir): void
{
$this->shutdown();
$this->warmupDir = $warmupDir;
$this->boot();
}
/**
* @return void
*/
public function terminate(Request $request, Response $response)
public function terminate(Request $request, Response $response): void
{
if (false === $this->booted) {
return;
@@ -158,10 +146,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
}
/**
* @return void
*/
public function shutdown()
public function shutdown(): void
{
if (false === $this->booted) {
return;
@@ -216,7 +201,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function getBundle(string $name): BundleInterface
{
if (!isset($this->bundles[$name])) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
throw new \InvalidArgumentException(\sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
}
return $this->bundles[$name];
@@ -225,11 +210,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function locateResource(string $name): string
{
if ('@' !== $name[0]) {
throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name));
throw new \InvalidArgumentException(\sprintf('A resource name must start with @ ("%s" given).', $name));
}
if (str_contains($name, '..')) {
throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name));
throw new \RuntimeException(\sprintf('File name "%s" contains invalid characters (..).', $name));
}
$bundleName = substr($name, 1);
@@ -243,7 +228,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
return $file;
}
throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Unable to find file "%s".', $name));
}
public function getEnvironment(): string
@@ -265,7 +250,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$r = new \ReflectionObject($this);
if (!is_file($dir = $r->getFileName())) {
throw new \LogicException(sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
throw new \LogicException(\sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
}
$dir = $rootDir = \dirname($dir);
@@ -292,10 +277,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
/**
* @internal
*
* @deprecated since Symfony 7.1, to be removed in 8.0
*/
public function setAnnotatedClassCache(array $annotatedClasses): void
{
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
trigger_deprecation('symfony/http-kernel', '7.1', 'The "%s()" method is deprecated since Symfony 7.1 and will be removed in 8.0.', __METHOD__);
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', \sprintf('<?php return %s;', var_export($annotatedClasses, true)));
}
public function getStartTime(): float
@@ -326,27 +315,31 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
/**
* Gets the patterns defining the classes to parse and cache for annotations.
*
* @return string[]
*
* @deprecated since Symfony 7.1, to be removed in 8.0
*/
public function getAnnotatedClassesToCompile(): array
{
trigger_deprecation('symfony/http-kernel', '7.1', 'The "%s()" method is deprecated since Symfony 7.1 and will be removed in 8.0.', __METHOD__);
return [];
}
/**
* Initializes bundles.
*
* @return void
*
* @throws \LogicException if two bundles share a common name
*/
protected function initializeBundles()
protected function initializeBundles(): void
{
// init bundles
$this->bundles = [];
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name));
throw new \LogicException(\sprintf('Trying to register two bundles with the same name "%s".', $name));
}
$this->bundles[$name] = $bundle;
}
@@ -356,10 +349,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
* The extension point similar to the Bundle::build() method.
*
* Use this method to register compiler passes and manipulate the container during the building process.
*
* @return void
*/
protected function build(ContainerBuilder $container)
protected function build(ContainerBuilder $container): void
{
}
@@ -375,7 +366,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$class = str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) {
throw new \InvalidArgumentException(sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
throw new \InvalidArgumentException(\sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
}
return $class;
@@ -396,18 +387,20 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*
* The built version of the service container is used when fresh, otherwise the
* container is built.
*
* @return void
*/
protected function initializeContainer()
protected function initializeContainer(): void
{
$class = $this->getContainerClass();
$buildDir = $this->warmupDir ?: $this->getBuildDir();
$cache = new ConfigCache($buildDir.'/'.$class.'.php', $this->debug);
$skip = $_SERVER['SYMFONY_DISABLE_RESOURCE_TRACKING'] ?? '';
$skip = filter_var($skip, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE) ?? explode(',', $skip);
$cache = new ConfigCache($buildDir.'/'.$class.'.php', $this->debug, null, \is_array($skip) && ['*'] !== $skip ? $skip : ($skip ? [] : null));
$cachePath = $cache->getPath();
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
$errorLevel = error_reporting();
error_reporting($errorLevel & ~\E_WARNING);
try {
if (is_file($cachePath) && \is_object($this->container = include $cachePath)
@@ -539,10 +532,18 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
touch($oldContainerDir.'.legacy');
}
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir) : [];
$buildDir = $this->container->getParameter('kernel.build_dir');
$cacheDir = $this->container->getParameter('kernel.cache_dir');
$preload = $this instanceof WarmableInterface ? $this->warmUp($cacheDir, $buildDir) : [];
if ($this->container->has('cache_warmer')) {
$preload = array_merge($preload, (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir));
$cacheWarmer = $this->container->get('cache_warmer');
if ($cacheDir !== $buildDir) {
$cacheWarmer->enableOptionalWarmers();
}
$preload = array_merge($preload, $cacheWarmer->warmUp($cacheDir, $buildDir));
}
if ($preload && file_exists($preloadFile = $buildDir.'/'.$class.'.preload.php')) {
@@ -552,6 +553,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
/**
* Returns the kernel parameters.
*
* @return array<string, array|bool|string|int|float|\UnitEnum|null>
*/
protected function getKernelParameters(): array
{
@@ -592,13 +595,13 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
protected function buildContainer(): ContainerBuilder
{
foreach (['cache' => $this->getCacheDir(), 'build' => $this->warmupDir ?: $this->getBuildDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
foreach (['cache' => $this->getCacheDir(), 'build' => $this->warmupDir ?: $this->getBuildDir()] as $name => $dir) {
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
}
} elseif (!is_writable($dir)) {
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
}
}
@@ -607,17 +610,13 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$this->prepareContainer($container);
$this->registerContainerConfiguration($this->getContainerLoader($container));
$container->addCompilerPass(new AddAnnotatedClassesToCachePass($this));
return $container;
}
/**
* Prepares the ContainerBuilder before it is compiled.
*
* @return void
*/
protected function prepareContainer(ContainerBuilder $container)
protected function prepareContainer(ContainerBuilder $container): void
{
$extensions = [];
foreach ($this->bundles as $bundle) {
@@ -667,10 +666,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*
* @param string $class The name of the class to generate
* @param string $baseClass The name of the container's base class
*
* @return void
*/
protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass)
protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass): void
{
// cache the container
$dumper = new PhpDumper($container);
@@ -682,30 +679,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
}
$inlineFactories = false;
if (isset($buildParameters['.container.dumper.inline_factories'])) {
$inlineFactories = $buildParameters['.container.dumper.inline_factories'];
} elseif ($container->hasParameter('container.dumper.inline_factories')) {
trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_factories');
$inlineFactories = $container->getParameter('container.dumper.inline_factories');
}
$inlineClassLoader = $this->debug;
if (isset($buildParameters['.container.dumper.inline_class_loader'])) {
$inlineClassLoader = $buildParameters['.container.dumper.inline_class_loader'];
} elseif ($container->hasParameter('container.dumper.inline_class_loader')) {
trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_class_loader');
$inlineClassLoader = $container->getParameter('container.dumper.inline_class_loader');
}
$content = $dumper->dump([
'class' => $class,
'base_class' => $baseClass,
'file' => $cache->getPath(),
'as_files' => true,
'debug' => $this->debug,
'inline_factories' => $inlineFactories,
'inline_class_loader' => $inlineClassLoader,
'inline_factories' => $buildParameters['.container.dumper.inline_factories'] ?? false,
'inline_class_loader' => $buildParameters['.container.dumper.inline_class_loader'] ?? $this->debug,
'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(),
'preload_classes' => array_map('get_class', $this->bundles),
]);
@@ -765,90 +746,41 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$container = $this->container;
if ($container->hasParameter('kernel.trusted_hosts') && $trustedHosts = $container->getParameter('kernel.trusted_hosts')) {
Request::setTrustedHosts($trustedHosts);
Request::setTrustedHosts(\is_array($trustedHosts) ? $trustedHosts : preg_split('/\s*+,\s*+(?![^{]*})/', $trustedHosts));
}
if ($container->hasParameter('kernel.trusted_proxies') && $container->hasParameter('kernel.trusted_headers') && $trustedProxies = $container->getParameter('kernel.trusted_proxies')) {
Request::setTrustedProxies(\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $container->getParameter('kernel.trusted_headers'));
$trustedHeaders = $container->getParameter('kernel.trusted_headers');
if (\is_string($trustedHeaders)) {
$trustedHeaders = array_map('trim', explode(',', $trustedHeaders));
}
if (\is_array($trustedHeaders)) {
$trustedHeaderSet = 0;
foreach ($trustedHeaders as $header) {
if (!\defined($const = Request::class.'::HEADER_'.strtr(strtoupper($header), '-', '_'))) {
throw new \InvalidArgumentException(\sprintf('The trusted header "%s" is not supported.', $header));
}
$trustedHeaderSet |= \constant($const);
}
} else {
$trustedHeaderSet = $trustedHeaders ?? (Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}
Request::setTrustedProxies(\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $trustedHeaderSet);
}
return $container;
}
/**
* Removes comments from a PHP source string.
*
* We don't use the PHP php_strip_whitespace() function
* as we want the content to be readable and well-formatted.
*
* @deprecated since Symfony 6.4 without replacement
*/
public static function stripComments(string $source): string
{
trigger_deprecation('symfony/http-kernel', '6.4', 'Method "%s()" is deprecated without replacement.', __METHOD__);
if (!\function_exists('token_get_all')) {
return $source;
}
$rawChunk = '';
$output = '';
$tokens = token_get_all($source);
$ignoreSpace = false;
for ($i = 0; isset($tokens[$i]); ++$i) {
$token = $tokens[$i];
if (!isset($token[1]) || 'b"' === $token) {
$rawChunk .= $token;
} elseif (\T_START_HEREDOC === $token[0]) {
$output .= $rawChunk.$token[1];
do {
$token = $tokens[++$i];
$output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token;
} while (\T_END_HEREDOC !== $token[0]);
$rawChunk = '';
} elseif (\T_WHITESPACE === $token[0]) {
if ($ignoreSpace) {
$ignoreSpace = false;
continue;
}
// replace multiple new lines with a single newline
$rawChunk .= preg_replace(['/\n{2,}/S'], "\n", $token[1]);
} elseif (\in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT])) {
if (!\in_array($rawChunk[\strlen($rawChunk) - 1], [' ', "\n", "\r", "\t"], true)) {
$rawChunk .= ' ';
}
$ignoreSpace = true;
} else {
$rawChunk .= $token[1];
// The PHP-open tag already has a new-line
if (\T_OPEN_TAG === $token[0]) {
$ignoreSpace = true;
} else {
$ignoreSpace = false;
}
}
}
$output .= $rawChunk;
unset($tokens, $rawChunk);
gc_mem_caches();
return $output;
}
public function __sleep(): array
{
return ['environment', 'debug'];
}
/**
* @return void
*/
public function __wakeup()
public function __wakeup(): void
{
if (\is_object($this->environment) || \is_object($this->debug)) {
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);